mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-31 01:59:26 +01:00
Merge branch 'develop'
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -133,6 +133,12 @@
|
||||
</label>
|
||||
<input type="text" name="mb_ignore_age" value="${config['mb_ignore_age']}" size="4">days
|
||||
</div>
|
||||
<div class="row checkbox">
|
||||
<label title="Ignore MusicBrainz album updates missing a release date.">
|
||||
Ignore Undated Releases
|
||||
</label>
|
||||
<input type="checkbox" name="mb_ignore_age_missing" id="mb_ignore_age_missing" value="${config['mb_ignore_age_missing']}">
|
||||
</div>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -2601,9 +2607,9 @@
|
||||
initConfigCheckbox("#api_enabled");
|
||||
initConfigCheckbox("#enable_https");
|
||||
initConfigCheckbox("#customauth");
|
||||
initConfigCheckbox("#mb_ignore_age_missing");
|
||||
initConfigCheckbox("#use_tquattrecentonze");
|
||||
|
||||
|
||||
$('#twitterStep1').click(function () {
|
||||
$.get("/twitterStep1", function (data) {window.open(data); })
|
||||
.done(function () { $('#ajaxMsg').html("<div class='msg'><span class='ui-icon ui-icon-check'></span>Confirm Authorization. Check pop-up blocker if no response.</div>"); });
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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']]))
|
||||
|
||||
@@ -167,6 +167,7 @@ _CONFIG_DEFINITIONS = {
|
||||
'LOSSLESS_BITRATE_TO': (int, 'General', 0),
|
||||
'LOSSLESS_DESTINATION_DIR': (path, 'General', ''),
|
||||
'MB_IGNORE_AGE': (int, 'General', 365),
|
||||
'MB_IGNORE_AGE_MISSING': (int, 'General', 0),
|
||||
'MININOVA': (int, 'Mininova', 0),
|
||||
'MININOVA_RATIO': (str, 'Mininova', ''),
|
||||
'MIRROR': (str, 'General', 'musicbrainz.org'),
|
||||
|
||||
@@ -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":
|
||||
logger.info("[%s] Now updating: %s (No Release Date)" % (artist['artist_name'], rg['title']))
|
||||
new_releases = mb.get_new_releases(rgid, includeExtras, True)
|
||||
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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -1160,6 +1160,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,
|
||||
|
||||
Reference in New Issue
Block a user