diff --git a/src/gam/__init__.py b/src/gam/__init__.py index dbcf5722..05c909a4 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -521,6 +521,7 @@ def SetGlobalVariables(): 'allcache.txt', filePresentValue=False, fileAbsentValue=True) + _getOldSignalFile(GC_NO_SHORT_URLS, 'noshorturls.txt') _getOldSignalFile(GC_NO_UPDATE_CHECK, 'noupdatecheck.txt') # Assign directories first for itemName in GC_VAR_INFO: diff --git a/src/gam/utils.py b/src/gam/utils.py index bdf19839..0fb2a834 100644 --- a/src/gam/utils.py +++ b/src/gam/utils.py @@ -320,6 +320,8 @@ URL_SHORTENER_ENDPOINT = 'https://gam-shortn.appspot.com/create' def shorten_url(long_url, httpc=None): + if GC_Defaults[GC_NO_SHORT_URLS]: + return long_url if not httpc: httpc = transport.create_http(timeout=10) headers = {'Content-Type': 'application/json', 'User-Agent': GAM_INFO} diff --git a/src/gam/var.py b/src/gam/var.py index 80ec9113..edbf2f13 100644 --- a/src/gam/var.py +++ b/src/gam/var.py @@ -1140,6 +1140,8 @@ GC_NO_BROWSER = 'no_browser' GC_OAUTH_BROWSER = 'oauth_browser' # Disable GAM API caching GC_NO_CACHE = 'no_cache' +# Disable Short URLs +GC_NO_SHORT_URLS = 'no_short_urls' # Disable GAM update check GC_NO_UPDATE_CHECK = 'no_update_check' # Number of threads for gam batch @@ -1185,6 +1187,7 @@ GC_Defaults = { GC_DRIVE_DIR: '', GC_NO_BROWSER: False, GC_NO_CACHE: False, + GC_NO_SHORT_URLS: False, GC_NO_UPDATE_CHECK: False, GC_NUM_THREADS: 25, GC_OAUTH_BROWSER: False, @@ -1264,6 +1267,9 @@ GC_VAR_INFO = { GC_NO_CACHE: { GC_VAR_TYPE: GC_TYPE_BOOLEAN }, + GC_NO_SHORT_URLS: { + GC_VAR_TYPE: GC_TYPE_BOOLEAN + }, GC_NO_UPDATE_CHECK: { GC_VAR_TYPE: GC_TYPE_BOOLEAN },