From 7c127610667066e92f12ae949fce43bb47fe338c Mon Sep 17 00:00:00 2001 From: "Get your own 'tots. Geez!" Date: Wed, 3 Aug 2016 09:27:44 -0600 Subject: [PATCH 01/13] Update config.py --- headphones/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/headphones/config.py b/headphones/config.py index 5b819007..5ba0151b 100644 --- a/headphones/config.py +++ b/headphones/config.py @@ -155,6 +155,7 @@ _CONFIG_DEFINITIONS = { 'LOSSLESS_BITRATE_TO': (int, 'General', 0), 'LOSSLESS_DESTINATION_DIR': (path, 'General', ''), 'MB_IGNORE_AGE': (int, 'General', 365), + 'MB_IGNORE_AGE_Empty': (int, 'General', 0), 'MININOVA': (int, 'Mininova', 0), 'MININOVA_RATIO': (str, 'Mininova', ''), 'MIRROR': (str, 'General', 'musicbrainz.org'), From 656e7161cb4b59fe31d9bb78af2781bdf2759643 Mon Sep 17 00:00:00 2001 From: "Get your own 'tots. Geez!" Date: Wed, 3 Aug 2016 09:29:09 -0600 Subject: [PATCH 02/13] Update config.py --- headphones/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headphones/config.py b/headphones/config.py index 5ba0151b..f0148877 100644 --- a/headphones/config.py +++ b/headphones/config.py @@ -155,7 +155,7 @@ _CONFIG_DEFINITIONS = { 'LOSSLESS_BITRATE_TO': (int, 'General', 0), 'LOSSLESS_DESTINATION_DIR': (path, 'General', ''), 'MB_IGNORE_AGE': (int, 'General', 365), - 'MB_IGNORE_AGE_Empty': (int, 'General', 0), + 'MB_IGNORE_AGE_MISSING': (int, 'General', 0), 'MININOVA': (int, 'Mininova', 0), 'MININOVA_RATIO': (str, 'Mininova', ''), 'MIRROR': (str, 'General', 'musicbrainz.org'), From 9cddcabad4f781b39e82f3180062b2f0bbe84a2b Mon Sep 17 00:00:00 2001 From: "Get your own 'tots. Geez!" Date: Wed, 3 Aug 2016 09:31:17 -0600 Subject: [PATCH 03/13] Update webserve.py --- headphones/webserve.py | 1 + 1 file changed, 1 insertion(+) diff --git a/headphones/webserve.py b/headphones/webserve.py index f4a06c2b..01330d0c 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -1139,6 +1139,7 @@ class WebInterface(object): "download_scan_interval": headphones.CONFIG.DOWNLOAD_SCAN_INTERVAL, "update_db_interval": headphones.CONFIG.UPDATE_DB_INTERVAL, "mb_ignore_age": headphones.CONFIG.MB_IGNORE_AGE, + "mb_ignore_age_missing": headphones.CONFIG.MB_IGNORE_AGE_MISSING, "search_interval": headphones.CONFIG.SEARCH_INTERVAL, "libraryscan_interval": headphones.CONFIG.LIBRARYSCAN_INTERVAL, "sab_host": headphones.CONFIG.SAB_HOST, From 14d1524971ec902e16f8274e62c2c46e094d4e9b Mon Sep 17 00:00:00 2001 From: "Get your own 'tots. Geez!" Date: Wed, 3 Aug 2016 09:53:53 -0600 Subject: [PATCH 04/13] Update config.html --- data/interfaces/default/config.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index a22a0ea7..7452be61 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -133,6 +133,12 @@ days +
+ + days +
From 372c6ffd3b503b4f8436db8612ec68ba6a3a284c Mon Sep 17 00:00:00 2001 From: "Get your own 'tots. Geez!" Date: Wed, 3 Aug 2016 10:07:01 -0600 Subject: [PATCH 05/13] Update config.html --- data/interfaces/default/config.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 7452be61..8c94d74e 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -137,7 +137,7 @@ - days + days From 7440b773773254e8a9a09f08b05b19b15f59cd47 Mon Sep 17 00:00:00 2001 From: "Get your own 'tots. Geez!" Date: Wed, 3 Aug 2016 10:22:55 -0600 Subject: [PATCH 06/13] Update importer.py --- headphones/importer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/headphones/importer.py b/headphones/importer.py index 3b92ca11..d067870b 100644 --- a/headphones/importer.py +++ b/headphones/importer.py @@ -262,8 +262,12 @@ def addArtisttoDB(artistid, extrasonly=False, forcefull=False, type="artist"): else: if check_release_date is None or check_release_date == u"None": + if mb_ignore_age_missing is not 1: logger.info("[%s] Now updating: %s (No Release Date)" % (artist['artist_name'], rg['title'])) new_releases = mb.get_new_releases(rgid, includeExtras, True) + else: + logger.info("[%s] Skipping update of: %s (No Release Date)" % (artist['artist_name'], rg['title'])) + new_releases = 0 else: if len(check_release_date) == 10: release_date = check_release_date From a62b55c40f38773021cf68f039f1c0b8170dc085 Mon Sep 17 00:00:00 2001 From: "Get your own 'tots. Geez!" Date: Wed, 3 Aug 2016 10:52:39 -0600 Subject: [PATCH 07/13] Update importer.py --- headphones/importer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headphones/importer.py b/headphones/importer.py index d067870b..a2d2622f 100644 --- a/headphones/importer.py +++ b/headphones/importer.py @@ -262,7 +262,7 @@ def addArtisttoDB(artistid, extrasonly=False, forcefull=False, type="artist"): else: if check_release_date is None or check_release_date == u"None": - if mb_ignore_age_missing is not 1: + if headphones.CONFIG.MB_IGNORE_AGE_MISSING is not 1: logger.info("[%s] Now updating: %s (No Release Date)" % (artist['artist_name'], rg['title'])) new_releases = mb.get_new_releases(rgid, includeExtras, True) else: From 95cc0670e2ddd94a77d68e1c27cbfc5c0ff51531 Mon Sep 17 00:00:00 2001 From: "Get your own 'tots. Geez!" Date: Wed, 3 Aug 2016 11:03:28 -0600 Subject: [PATCH 08/13] Update config.html --- data/interfaces/default/config.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 8c94d74e..18b00f60 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -135,9 +135,9 @@
- days +
From ed923a2a942f7c33b4bc6e659c910ea04b4a31ce Mon Sep 17 00:00:00 2001 From: "Get your own 'tots. Geez!" Date: Wed, 3 Aug 2016 11:09:05 -0600 Subject: [PATCH 09/13] Update config.html --- data/interfaces/default/config.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 18b00f60..e148bfb9 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -137,7 +137,7 @@ - + @@ -2406,6 +2406,7 @@ initConfigCheckbox("#api_enabled"); initConfigCheckbox("#enable_https"); initConfigCheckbox("#customauth"); + initConfigCheckbox("#mb_ignore_age_missing"); $('#twitterStep1').click(function () { From 3cc280666e618bc261725847f75f6685bc3dc9c5 Mon Sep 17 00:00:00 2001 From: Lartza Date: Wed, 18 Oct 2017 22:44:37 +0300 Subject: [PATCH 10/13] Fix encoding selection on Windows --- Headphones.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Headphones.py b/Headphones.py index e4506797..5ad2454d 100755 --- a/Headphones.py +++ b/Headphones.py @@ -54,7 +54,10 @@ def main(): try: locale.setlocale(locale.LC_ALL, "") - headphones.SYS_ENCODING = locale.getpreferredencoding() + if headphones.SYS_PLATFORM == 'win32': + headphones.SYS_ENCODING = sys.getdefaultencoding().upper() + else: + headphones.SYS_ENCODING = locale.getpreferredencoding() except (locale.Error, IOError): pass From 4283b381b6780340f02c64c649d2851d5df25177 Mon Sep 17 00:00:00 2001 From: "Get your own 'tots. Geez!" Date: Thu, 22 Feb 2018 19:17:23 -0700 Subject: [PATCH 11/13] Fix indentation. --- headphones/importer.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/headphones/importer.py b/headphones/importer.py index a2d2622f..0426004d 100644 --- a/headphones/importer.py +++ b/headphones/importer.py @@ -262,12 +262,12 @@ def addArtisttoDB(artistid, extrasonly=False, forcefull=False, type="artist"): else: if check_release_date is None or check_release_date == u"None": - if headphones.CONFIG.MB_IGNORE_AGE_MISSING is not 1: - logger.info("[%s] Now updating: %s (No Release Date)" % (artist['artist_name'], rg['title'])) - new_releases = mb.get_new_releases(rgid, includeExtras, True) - else: - logger.info("[%s] Skipping update of: %s (No Release Date)" % (artist['artist_name'], rg['title'])) - new_releases = 0 + if headphones.CONFIG.MB_IGNORE_AGE_MISSING is not 1: + logger.info("[%s] Now updating: %s (No Release Date)" % (artist['artist_name'], rg['title'])) + new_releases = mb.get_new_releases(rgid, includeExtras, True) + else: + logger.info("[%s] Skipping update of: %s (No Release Date)" % (artist['artist_name'], rg['title'])) + new_releases = 0 else: if len(check_release_date) == 10: release_date = check_release_date From 22eb21a4ef17bc7a08e166529cc285bc7e3eb4e0 Mon Sep 17 00:00:00 2001 From: Ade Date: Sat, 3 Mar 2018 20:02:14 +1300 Subject: [PATCH 12/13] Jackett seeders Use Soup to get seeders returned from Jackett Fixes #3081 --- headphones/searcher.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/headphones/searcher.py b/headphones/searcher.py index 2fc5e78d..74cad281 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -1292,10 +1292,13 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None, if headphones.CONFIG.PREFERRED_QUALITY == 3 or losslessOnly: categories = "3040" + maxsize = 10000000000 elif headphones.CONFIG.PREFERRED_QUALITY == 1 or allow_lossless: categories = "3040,3010,3050" + maxsize = 10000000000 else: categories = "3010,3050" + maxsize = 300000000 if album['Type'] == 'Other': categories = "3030" @@ -1321,20 +1324,22 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None, "q": term } - data = request.request_feed( + data = request.request_soup( url=torznab_host[0], params=params, headers=headers ) # Process feed if data: - if not len(data.entries): + items = data.find_all('item') + if not items: logger.info(u"No results found from %s for %s", provider, term) else: - for item in data.entries: + for item in items: try: - url = item.link - title = item.title + title = item.title.get_text() + url = item.find("link").next_sibling.strip() + seeders = int(item.find("torznab:attr", attrs={"name": "seeders"}).get('value')) # Torrentech hack - size currently not returned, make it up if 'torrentech' in torznab_host[0]: @@ -1349,12 +1354,17 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None, logger.info('Skipping %s, could not determine size' % title) continue else: - size = int(item.links[1]['length']) + size = int(item.size.string) if all(word.lower() in title.lower() for word in term.split()): - logger.info( - 'Found %s. Size: %s' % (title, helpers.bytes_to_mb(size))) - resultlist.append((title, size, url, provider, 'torrent', True)) + if size < maxsize and minimumseeders < seeders: + logger.info('Found %s. Size: %s' % (title, helpers.bytes_to_mb(size))) + resultlist.append((title, size, url, provider, 'torrent', True)) + else: + logger.info( + '%s is larger than the maxsize or has too little seeders for this category, ' + 'skipping. (Size: %i bytes, Seeders: %d)', + title, size, seeders) else: logger.info('Skipping %s, not all search term words found' % title) From 5d7fdc7a824054375bfd693a3d394d57000289fa Mon Sep 17 00:00:00 2001 From: Ade Date: Tue, 6 Mar 2018 16:47:47 +1300 Subject: [PATCH 13/13] Speed up Choose Alternate Release Possible fix for #3078 --- headphones/__init__.py | 2 ++ headphones/albumswitcher.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/headphones/__init__.py b/headphones/__init__.py index c6acc763..2d622766 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -417,6 +417,8 @@ def dbcheck(): 'CREATE INDEX IF NOT EXISTS tracks_Location ON tracks(Location ASC)') c.execute( 'CREATE INDEX IF NOT EXISTS alltracks_Location ON alltracks(Location ASC)') + c.execute( + 'CREATE INDEX IF NOT EXISTS tracks_artistid ON tracks(ArtistID ASC)') try: c.execute('SELECT IncludeExtras from artists') diff --git a/headphones/albumswitcher.py b/headphones/albumswitcher.py index 74f1077f..89325ed7 100644 --- a/headphones/albumswitcher.py +++ b/headphones/albumswitcher.py @@ -85,8 +85,8 @@ def switch(AlbumID, ReleaseID): # Update have track counts on index totaltracks = len(myDB.select( - 'SELECT TrackTitle from tracks WHERE ArtistID=? AND AlbumID IN (SELECT AlbumID FROM albums WHERE Status != "Ignored")', - [newalbumdata['ArtistID']])) + 'SELECT TrackTitle from tracks AS tr INNER JOIN albums AS al ON al.AlbumID = tr.AlbumID WHERE al.ArtistID=? ' + 'AND al.Status != "Ignored"', [newalbumdata['ArtistID']])) havetracks = len(myDB.select( 'SELECT TrackTitle from tracks WHERE ArtistID=? AND Location IS NOT NULL', [newalbumdata['ArtistID']]))