Compare commits

...
Author SHA1 Message Date
rembo10 16d4ac8895 Fixed some imports in helpers.py 2022-02-09 02:48:50 +05:30
rembo10 f4d60226b3 Disable last.fm getSimilar 2022-02-08 19:37:33 +05:30
rembo10 9ca87e23b2 A less insane library scan interval 2022-02-08 19:27:44 +05:30
4 changed files with 27 additions and 28 deletions
+1 -1
View File
@@ -157,7 +157,7 @@ _CONFIG_DEFINITIONS = {
'LASTFM_USERNAME': (str, 'General', ''),
'LAUNCH_BROWSER': (int, 'General', 1),
'LIBRARYSCAN': (int, 'General', 1),
'LIBRARYSCAN_INTERVAL': (int, 'General', 300),
'LIBRARYSCAN_INTERVAL': (int, 'General', 24),
'LMS_ENABLED': (int, 'LMS', 0),
'LMS_HOST': (str, 'LMS', ''),
'LOG_DIR': (path, 'General', ''),
+21 -23
View File
@@ -14,25 +14,25 @@
# You should have received a copy of the GNU General Public License
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
from operator import itemgetter
import unicodedata
import datetime
import os
import re
import shutil
import time
import sys
import tempfile
import glob
import time
import unicodedata
from contextlib import contextmanager
from datetime import datetime, date
from fnmatch import fnmatch
from functools import cmp_to_key
from glob import glob
from operator import itemgetter
from beets import logging as beetslogging
import six
from contextlib import contextmanager
import fnmatch
import functools
import re
import os
from mediafile import MediaFile, FileTypeError, UnreadableFileError
from six import text_type
from unidecode import unidecode
import headphones
@@ -74,7 +74,7 @@ def multikeysort(items, columns):
else:
return 0
return sorted(items, key=functools.cmp_to_key(comparer))
return sorted(items, key=cmp_to_key(comparer))
def checked(variable):
@@ -156,21 +156,19 @@ def convert_seconds(s):
def today():
today = datetime.date.today()
yyyymmdd = datetime.date.isoformat(today)
return yyyymmdd
return date.isoformat(date.today())
def now():
now = datetime.datetime.now()
now = datetime.now()
return now.strftime("%Y-%m-%d %H:%M:%S")
def is_valid_date(date):
if not date:
def is_valid_date(d):
if not d:
return False
else:
return bool(re.match(r'\d{4}-\d{2}-\d{2}', date))
return bool(re.match(r'\d{4}-\d{2}-\d{2}', d))
def age(d):
@@ -508,7 +506,7 @@ def path_match_patterns(path, patterns):
"""
for pattern in patterns:
if fnmatch.fnmatch(path, pattern):
if fnmatch(path, pattern):
return True
# No match
@@ -714,7 +712,7 @@ def preserve_torrent_directory(albumpath, forced=False, single=False):
workdir = os.path.join(tempdir, prefix)
workdir = re.sub(r'\[', '[[]', workdir)
workdir = re.sub(r'(?<!\[)\]', '[]]', workdir)
if len(glob.glob(workdir + '*/')) >= 3:
if len(glob(workdir + '*/')) >= 3:
logger.error(
"Looks like a temp directory has previously been created "
"for this albumpath, not continuing "
@@ -1033,7 +1031,7 @@ class BeetsLogCapture(beetslogging.Handler):
self.messages = []
def emit(self, record):
self.messages.append(six.text_type(record.msg))
self.messages.append(text_type(record.msg))
@contextmanager
+2 -2
View File
@@ -63,12 +63,12 @@ def request_lastfm(method, **kwargs):
def getSimilar():
myDB = db.DBConnection()
results = myDB.select("SELECT ArtistID from artists ORDER BY HaveTracks DESC")
results = myDB.select("SELECT ArtistID from artists ORDER BY HaveTracks DESC LIMIT 10")
logger.info("Fetching similar artists from Last.FM for tag cloud")
artistlist = []
for result in results[:12]:
for result in results:
data = request_lastfm("artist.getsimilar", mbid=result["ArtistId"])
if data and "similarartists" in data:
+3 -2
View File
@@ -442,8 +442,9 @@ def libraryScan(dir=None, append=False, ArtistID=None, ArtistName=None,
# if not append:
# update_album_status()
if not append and not artistScan:
lastfm.getSimilar()
# TODO: Fix last.fm api calls
#if not append and not artistScan:
#lastfm.getSimilar()
if ArtistName:
logger.info('Scanning complete for artist: %s', ArtistName)