mirror of
https://github.com/rembo10/headphones.git
synced 2026-04-17 18:39:28 +01:00
Merge branch 'prefer-torrents' into develop
This commit is contained in:
@@ -250,6 +250,12 @@
|
||||
<label>Keep Files for Seeding</label>
|
||||
<input type="checkbox" name="keep_torrent_files" value="1" ${config['keep_torrent_files']}>
|
||||
</div>
|
||||
<div class="row checkbox">
|
||||
<label>Prefer</label>
|
||||
<input type="radio" name="prefer_torrents" id="prefer_torrents_0" value="0" ${config['prefer_torrents_0']}>NZBs
|
||||
<input type="radio" name="prefer_torrents" id="prefer_torrents_1" value="1" ${config['prefer_torrents_1']}>Torrents
|
||||
<input type="radio" name="prefer_torrents" id="prefer_torrents_2" value="2" ${config['prefer_torrents_2']}>No Preference
|
||||
</div>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -126,6 +126,7 @@ EXTRAS = None
|
||||
AUTOWANT_UPCOMING = False
|
||||
AUTOWANT_ALL = False
|
||||
KEEP_TORRENT_FILES = False
|
||||
PREFER_TORRENTS = None # 0: nzbs, 1: torrents, 2: no preference
|
||||
|
||||
SEARCH_INTERVAL = 360
|
||||
LIBRARYSCAN = False
|
||||
@@ -335,7 +336,7 @@ def initialize():
|
||||
HTTP_PORT, HTTP_HOST, HTTP_USERNAME, HTTP_PASSWORD, HTTP_ROOT, HTTP_PROXY, LAUNCH_BROWSER, API_ENABLED, API_KEY, GIT_PATH, GIT_USER, GIT_BRANCH, DO_NOT_OVERRIDE_GIT_BRANCH, \
|
||||
CURRENT_VERSION, LATEST_VERSION, CHECK_GITHUB, CHECK_GITHUB_ON_STARTUP, CHECK_GITHUB_INTERVAL, MUSIC_DIR, DESTINATION_DIR, \
|
||||
LOSSLESS_DESTINATION_DIR, PREFERRED_QUALITY, PREFERRED_BITRATE, DETECT_BITRATE, ADD_ARTISTS, CORRECT_METADATA, MOVE_FILES, \
|
||||
RENAME_FILES, FOLDER_FORMAT, FILE_FORMAT, FILE_UNDERSCORES, CLEANUP_FILES, INCLUDE_EXTRAS, EXTRAS, AUTOWANT_UPCOMING, AUTOWANT_ALL, KEEP_TORRENT_FILES, \
|
||||
RENAME_FILES, FOLDER_FORMAT, FILE_FORMAT, FILE_UNDERSCORES, CLEANUP_FILES, INCLUDE_EXTRAS, EXTRAS, AUTOWANT_UPCOMING, AUTOWANT_ALL, KEEP_TORRENT_FILES, PREFER_TORRENTS, \
|
||||
ADD_ALBUM_ART, ALBUM_ART_FORMAT, EMBED_ALBUM_ART, EMBED_LYRICS, DOWNLOAD_DIR, BLACKHOLE, BLACKHOLE_DIR, USENET_RETENTION, SEARCH_INTERVAL, \
|
||||
TORRENTBLACKHOLE_DIR, NUMBEROFSEEDERS, ISOHUNT, KAT, PIRATEBAY, PIRATEBAY_PROXY_URL, MININOVA, WAFFLES, WAFFLES_UID, WAFFLES_PASSKEY, \
|
||||
RUTRACKER, RUTRACKER_USER, RUTRACKER_PASSWORD, WHATCD, WHATCD_USERNAME, WHATCD_PASSWORD, DOWNLOAD_TORRENT_DIR, \
|
||||
@@ -451,6 +452,7 @@ def initialize():
|
||||
AUTOWANT_UPCOMING = bool(check_setting_int(CFG, 'General', 'autowant_upcoming', 1))
|
||||
AUTOWANT_ALL = bool(check_setting_int(CFG, 'General', 'autowant_all', 0))
|
||||
KEEP_TORRENT_FILES = bool(check_setting_int(CFG, 'General', 'keep_torrent_files', 0))
|
||||
PREFER_TORRENTS = check_setting_int(CFG, 'General', 'prefer_torrents', 0)
|
||||
|
||||
SEARCH_INTERVAL = check_setting_int(CFG, 'General', 'search_interval', 1440)
|
||||
LIBRARYSCAN = bool(check_setting_int(CFG, 'General', 'libraryscan', 1))
|
||||
@@ -857,6 +859,7 @@ def config_write():
|
||||
new_config['General']['autowant_upcoming'] = int(AUTOWANT_UPCOMING)
|
||||
new_config['General']['autowant_all'] = int(AUTOWANT_ALL)
|
||||
new_config['General']['keep_torrent_files'] = int(KEEP_TORRENT_FILES)
|
||||
new_config['General']['prefer_torrents'] = PREFER_TORRENTS
|
||||
|
||||
new_config['General']['numberofseeders'] = NUMBEROFSEEDERS
|
||||
new_config['General']['torrentblackhole_dir'] = TORRENTBLACKHOLE_DIR
|
||||
|
||||
@@ -757,7 +757,7 @@ def correctMetadata(albumid, release, downloaded_track_list):
|
||||
except Exception, e:
|
||||
logger.error('Error getting recommendation: %s. Not writing metadata' % e)
|
||||
return
|
||||
if rec == 'RECOMMEND_NONE':
|
||||
if rec == 'recommendation.none':
|
||||
logger.warn('No accurate album match found for %s, %s - not writing metadata' % (release['ArtistName'], release['AlbumTitle']))
|
||||
return
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -948,6 +948,9 @@ class WebInterface(object):
|
||||
"autowant_upcoming" : checked(headphones.AUTOWANT_UPCOMING),
|
||||
"autowant_all" : checked(headphones.AUTOWANT_ALL),
|
||||
"keep_torrent_files" : checked(headphones.KEEP_TORRENT_FILES),
|
||||
"prefer_torrents_0" : radio(headphones.PREFER_TORRENTS, 0),
|
||||
"prefer_torrents_1" : radio(headphones.PREFER_TORRENTS, 1),
|
||||
"prefer_torrents_2" : radio(headphones.PREFER_TORRENTS, 2),
|
||||
"log_dir" : headphones.LOG_DIR,
|
||||
"cache_dir" : headphones.CACHE_DIR,
|
||||
"interface_list" : interface_list,
|
||||
@@ -1047,7 +1050,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,
|
||||
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, autowant_upcoming=False, autowant_all=False, keep_torrent_files=False, interface=None, log_dir=None, cache_dir=None, music_encoder=0, encoder=None, xldprofile=None,
|
||||
remix=0, spokenword=0, audiobook=0, autowant_upcoming=False, autowant_all=False, keep_torrent_files=False, prefer_torrents=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,
|
||||
@@ -1148,6 +1151,7 @@ class WebInterface(object):
|
||||
headphones.AUTOWANT_UPCOMING = autowant_upcoming
|
||||
headphones.AUTOWANT_ALL = autowant_all
|
||||
headphones.KEEP_TORRENT_FILES = keep_torrent_files
|
||||
headphones.PREFER_TORRENTS = int(prefer_torrents)
|
||||
headphones.INTERFACE = interface
|
||||
headphones.LOG_DIR = log_dir
|
||||
headphones.CACHE_DIR = cache_dir
|
||||
|
||||
@@ -242,6 +242,6 @@ def apply_metadata(album_info, mapping):
|
||||
item[field] = value
|
||||
if track_info.disctitle is not None:
|
||||
item.disctitle = track_info.disctitle
|
||||
|
||||
|
||||
# Headphones seal of approval
|
||||
item.comments = 'tagged by headphones/beets'
|
||||
|
||||
@@ -21,7 +21,7 @@ from beets import plugins
|
||||
from beets import config
|
||||
from beets.autotag import mb
|
||||
from beets.util import levenshtein
|
||||
from lib.unidecode import unidecode
|
||||
from unidecode import unidecode
|
||||
|
||||
log = logging.getLogger('beets')
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ from __future__ import division
|
||||
import datetime
|
||||
import logging
|
||||
import re
|
||||
from lib.munkres import Munkres
|
||||
from munkres import Munkres
|
||||
|
||||
from beets import plugins
|
||||
from beets import config
|
||||
|
||||
@@ -21,7 +21,7 @@ import logging
|
||||
import shlex
|
||||
import unicodedata
|
||||
import time
|
||||
from lib.unidecode import unidecode
|
||||
from unidecode import unidecode
|
||||
from beets.mediafile import MediaFile, MutagenError
|
||||
from beets import plugins
|
||||
from beets import util
|
||||
|
||||
@@ -1082,7 +1082,7 @@ default_commands.append(version_cmd)
|
||||
|
||||
# modify: Declaratively change metadata.
|
||||
|
||||
def modify_items(lib, mods, query, write, move, album, confirm):
|
||||
def modify_items(lib, mods, dels, query, write, move, album, confirm):
|
||||
"""Modifies matching items according to key=value assignments."""
|
||||
# Parse key=value specifications into a dictionary.
|
||||
model_cls = library.Album if album else library.Item
|
||||
@@ -1102,6 +1102,8 @@ def modify_items(lib, mods, query, write, move, album, confirm):
|
||||
for obj in objs:
|
||||
for field, value in fsets.iteritems():
|
||||
obj[field] = value
|
||||
for field in dels:
|
||||
del obj[field]
|
||||
if ui.show_model_changes(obj):
|
||||
changed.add(obj)
|
||||
|
||||
@@ -1155,13 +1157,22 @@ modify_cmd.parser.add_option('-f', '--format', action='store',
|
||||
help='print with custom format', default=None)
|
||||
def modify_func(lib, opts, args):
|
||||
args = decargs(args)
|
||||
mods = [a for a in args if '=' in a]
|
||||
query = [a for a in args if '=' not in a]
|
||||
if not mods:
|
||||
mods = []
|
||||
dels = []
|
||||
query = []
|
||||
for arg in args:
|
||||
if arg.endswith('!') and '=' not in arg and ':' not in arg:
|
||||
dels.append(arg[:-1])
|
||||
elif '=' in arg:
|
||||
mods.append(arg)
|
||||
else:
|
||||
query.append(arg)
|
||||
if not mods and not dels:
|
||||
raise ui.UserError('no modifications specified')
|
||||
write = opts.write if opts.write is not None else \
|
||||
config['import']['write'].get(bool)
|
||||
modify_items(lib, mods, query, write, opts.move, opts.album, not opts.yes)
|
||||
modify_items(lib, mods, dels, query, write, opts.move, opts.album,
|
||||
not opts.yes)
|
||||
modify_cmd.func = modify_func
|
||||
default_commands.append(modify_cmd)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user