From 48b2b9235d3deb0207f06827c7a102fa22dfd281 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 5 Aug 2014 13:57:02 +0200 Subject: [PATCH 1/5] Creating set_proxy, which generates proxy urls Making it a function reduces the amount of repetition. --- headphones/searcher.py | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/headphones/searcher.py b/headphones/searcher.py index 8570e152..2307ee16 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -895,23 +895,24 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None): pre_sorted_results = False minimumseeders = int(headphones.NUMBEROFSEEDERS) - 1 + def set_proxy(proxy_url): + if not proxy_url.startswith('http'): + proxy_url = 'http://' + proxy_url + if proxy_url.endswith('/'): + proxy_url = proxy_url[:-1] + + return proxy_url + + if headphones.KAT: provider = "Kick Ass Torrents" - + if headphones.KAT_PROXY_URL: - #Might need to clean up the user submitted url - kat_proxy = headphones.KAT_PROXY_URL - - if not kat_proxy.startswith('http'): - kat_proxy = 'http://' + kat_proxy - if kat_proxy.endswith('/'): - kat_proxy = kat_proxy[:-1] - - providerurl = url_fix(kat_proxy + "/usearch/" + term) - + proxy_url = set_proxy(headphones.KAT_PROXY_URL) + providerurl = url_fix(proxy_url + "/usearch/" + term) else: providerurl = url_fix("http://kickass.to/usearch/" + term) - + if headphones.PREFERRED_QUALITY == 3 or losslessOnly: categories = "7" #music format = "2" #flac @@ -1156,16 +1157,8 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None): if headphones.PIRATEBAY: provider = "The Pirate Bay" if headphones.PIRATEBAY_PROXY_URL: - #Might need to clean up the user submitted url - pirate_proxy = headphones.PIRATEBAY_PROXY_URL - - if not pirate_proxy.startswith('http'): - pirate_proxy = 'http://' + pirate_proxy - if pirate_proxy.endswith('/'): - pirate_proxy = pirate_proxy[:-1] - - providerurl = url_fix(pirate_proxy + "/search/" + term + "/0/99/") - + proxy_url = set_proxy(headphones.PIRATEBAY_PROXY_URL) + providerurl = url_fix(proxy_url + "/search/" + term + "/0/99/") else: providerurl = url_fix("http://thepiratebay.se/search/" + term + "/0/99/") From bd8da45c1ad6bded846f1d13c1bf426991253ce2 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 5 Aug 2014 17:07:55 +0200 Subject: [PATCH 2/5] Replacing redundant code with variable --- headphones/postprocessor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py index 84055452..3ecd590c 100644 --- a/headphones/postprocessor.py +++ b/headphones/postprocessor.py @@ -848,11 +848,11 @@ def embedLyrics(downloaded_track_list): # TODO: If adding lyrics for flac & lossy, only fetch the lyrics once # and apply it to both files for downloaded_track in downloaded_track_list: - + track_title = downloaded_track.decode(headphones.SYS_ENCODING, 'replace') try: f = MediaFile(downloaded_track) except: - logger.error('Could not read %s. Not checking lyrics', downloaded_track.decode(headphones.SYS_ENCODING, 'replace')) + logger.error('Could not read %s. Not checking lyrics', track_title) continue if f.albumartist and f.title: @@ -860,16 +860,16 @@ def embedLyrics(downloaded_track_list): elif f.artist and f.title: metalyrics = lyrics.getLyrics(f.artist, f.title) else: - logger.info('No artist/track metadata found for track: %s. Not fetching lyrics', downloaded_track.decode(headphones.SYS_ENCODING, 'replace')) + logger.info('No artist/track metadata found for track: %s. Not fetching lyrics', track_title) metalyrics = None if lyrics: - logger.debug('Adding lyrics to: %s', downloaded_track.decode(headphones.SYS_ENCODING, 'replace')) + logger.debug('Adding lyrics to: %s', track_title) f.lyrics = metalyrics try: f.save() except: - logger.error('Cannot save lyrics to: %s. Skipping', downloaded_track.decode(headphones.SYS_ENCODING, 'replace')) + logger.error('Cannot save lyrics to: %s. Skipping', track_title) continue def renameFiles(albumpath, downloaded_track_list, release): From 98604a2ab84fd57bbd1c1448bbe660a481c54bea Mon Sep 17 00:00:00 2001 From: David Date: Tue, 5 Aug 2014 17:10:48 +0200 Subject: [PATCH 3/5] Make embedLyrics() actually check if lyrics found Checking metalyrics, the variable, not lyrics the module --- headphones/postprocessor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py index 3ecd590c..a2258946 100644 --- a/headphones/postprocessor.py +++ b/headphones/postprocessor.py @@ -863,7 +863,7 @@ def embedLyrics(downloaded_track_list): logger.info('No artist/track metadata found for track: %s. Not fetching lyrics', track_title) metalyrics = None - if lyrics: + if metalyrics: logger.debug('Adding lyrics to: %s', track_title) f.lyrics = metalyrics try: @@ -871,6 +871,9 @@ def embedLyrics(downloaded_track_list): except: logger.error('Cannot save lyrics to: %s. Skipping', track_title) continue + else: + logger.debug('No lyrics found for track: %s', track_title) + def renameFiles(albumpath, downloaded_track_list, release): logger.info('Renaming files') From 9849a8334f48859a1a30242b6b2ab3e39f46a21c Mon Sep 17 00:00:00 2001 From: piejanssens Date: Tue, 5 Aug 2014 20:51:48 +0200 Subject: [PATCH 4/5] Added additional extra's for albums (e.g. dj-mix or mixtape/street). --- headphones/mb.py | 2 +- headphones/webserve.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/headphones/mb.py b/headphones/mb.py index d9cc96e6..25188f50 100644 --- a/headphones/mb.py +++ b/headphones/mb.py @@ -221,7 +221,7 @@ def getArtist(artistid, extrasonly=False): # Need to convert extras string from something like '2,5.6' to ['ep','live','remix'] extras = db_artist['Extras'] - extras_list = ["single", "ep", "compilation", "soundtrack", "live", "remix", "spokenword", "audiobook", "other"] + extras_list = ["single", "ep", "compilation", "soundtrack", "live", "remix", "dj-mix", "mixtape/street", "spokenword", "audiobook", "broadcast", "interview", "other"] includes = [] i = 1 diff --git a/headphones/webserve.py b/headphones/webserve.py index 3a7c6f16..a1e1a985 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -85,7 +85,7 @@ class WebInterface(object): raise cherrypy.HTTPRedirect("home") # Serve the extras up as a dict to make things easier for new templates - extras_list = ["single", "ep", "compilation", "soundtrack", "live", "remix", "spokenword", "audiobook", "other"] + extras_list = ["single", "ep", "compilation", "soundtrack", "live", "remix", "djmix", "mixtape_street", "spokenword", "audiobook", "broadcast", "interview", "other"] extras_dict = {} if not artist['Extras']: @@ -143,12 +143,12 @@ class WebInterface(object): # # If they are, we need to convert kwargs to string format if not newstyle: - extras = "1,2,3,4,5,6,7,8,9" + extras = "1,2,3,4,5,6,7,8,9,10,11,12,13" else: temp_extras_list = [] # TODO: Put these extras as a global variable i = 1 - for extra in ["single", "ep", "compilation", "soundtrack", "live", "remix", "spokenword", "audiobook", "other"]: + for extra in ["single", "ep", "compilation", "soundtrack", "live", "remix", "djmix", "mixtape_street", "spokenword", "audiobook", "broadcast", "interview", "other"]: if extra in kwargs: temp_extras_list.append(i) i += 1 @@ -1115,7 +1115,7 @@ class WebInterface(object): } # Need to convert EXTRAS to a dictionary we can pass to the config: it'll come in as a string like 2,5,6,8 - extras_list = ["single", "ep", "compilation", "soundtrack", "live", "remix", "spokenword", "audiobook", "other"] + extras_list = ["single", "ep", "compilation", "soundtrack", "live", "remix", "dj-mix", "mixtape/street", "spokenword", "audiobook", "broadcast", "interview", "other"] extras_dict = {} i = 1 @@ -1140,7 +1140,7 @@ class WebInterface(object): numberofseeders=None, use_piratebay=0, piratebay_proxy_url=None, use_isohunt=0, use_kat=0, use_mininova=0, waffles=0, waffles_uid=None, waffles_passkey=None, whatcd=0, whatcd_username=None, whatcd_password=None, rutracker=0, rutracker_user=None, rutracker_password=None, rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, album_art_format=None, embed_album_art=0, embed_lyrics=0, replace_existing_folders=False, destination_dir=None, lossless_destination_dir=None, folder_format=None, file_format=None, file_underscores=0, include_extras=0, single=0, ep=0, compilation=0, soundtrack=0, live=0, - remix=0, spokenword=0, audiobook=0, other=0, autowant_upcoming=False, autowant_all=False, keep_torrent_files=False, prefer_torrents=0, open_magnet_links=0, interface=None, log_dir=None, cache_dir=None, music_encoder=0, encoder=None, xldprofile=None, + remix=0, djmix=0, mixtape_street=0, broadcast=0, interview=0, spokenword=0, audiobook=0, other=0, autowant_upcoming=False, autowant_all=False, keep_torrent_files=False, prefer_torrents=0, open_magnet_links=0, interface=None, log_dir=None, cache_dir=None, music_encoder=0, encoder=None, xldprofile=None, bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None, encodervbrcbr=None, encoderquality=None, encoderlossless=0, delete_lossless_files=0, growl_enabled=0, growl_onsnatch=0, growl_host=None, growl_password=None, prowl_enabled=0, prowl_onsnatch=0, prowl_keys=None, prowl_priority=0, xbmc_enabled=0, xbmc_host=None, xbmc_username=None, xbmc_password=None, xbmc_update=0, xbmc_notify=0, nma_enabled=False, nma_apikey=None, nma_priority=0, nma_onsnatch=0, pushalot_enabled=False, pushalot_apikey=None, pushalot_onsnatch=0, synoindex_enabled=False, lms_enabled=0, lms_host=None, @@ -1350,7 +1350,7 @@ class WebInterface(object): # Convert the extras to list then string. Coming in as 0 or 1 temp_extras_list = [] - extras_list = [single, ep, compilation, soundtrack, live, remix, spokenword, audiobook, other] + extras_list = [single, ep, compilation, soundtrack, live, remix, djmix, mixtape_street, spokenword, audiobook, broadcast, interview, other] i = 1 for extra in extras_list: From 78c866ce59207ba3909b30c6aa7aa6c5c3161115 Mon Sep 17 00:00:00 2001 From: Pieter Janssens Date: Tue, 5 Aug 2014 21:36:25 +0200 Subject: [PATCH 5/5] Update README with IRC instructions We have an IRC channel now! --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 08cac699..f30577f2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,17 @@ #![preview thumb](https://github.com/rembo10/headphones/raw/master/data/images/headphoneslogo.png)Headphones +###Support & Discuss + +You are free to join the HP support community on IRC where you can ask questions, hang around and discuss anything related to HP. + +1. Use any IRC client and connect to the Freenode server. +2. Join #headphones + ###Installation and Notes [Read our Wiki](../../wiki) on how to install and use HeadPhones properly. -**Issues** can be reported on the GitHub issue tracker considering these two rules: +**Issues** can be reported on the GitHub issue tracker considering these rules: 1. Analyze your log, you just might find the solution yourself! 2. You read the wiki and searched existing issues, but this is not solving your problem. @@ -16,7 +23,10 @@ 1. Search for similar existing 'issues', feature requests can be recognized by the label 'Request'. 2. If a similar Request exists, post a comment (+1, or add a new idea to the existing request), otherwise you can create a new one. -If you **comply with these rules** you can [post your issue](http://github.com/rembo10/headphones/issues). +If you **comply with these rules** you can [post your request/issue](http://github.com/rembo10/headphones/issues). + +**Support** the project by implementing new features, solving support tickets and provide bug fixes. +If you change something in the code always make a PR to the developer branch instead of the master branch. ###Screenshots