malojaserver 3.2.1__py3-none-any.whl → 3.2.3__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. maloja/__main__.py +1 -1
  2. maloja/__pkginfo__.py +1 -1
  3. maloja/apis/_base.py +26 -19
  4. maloja/apis/_exceptions.py +1 -1
  5. maloja/apis/audioscrobbler.py +35 -7
  6. maloja/apis/audioscrobbler_legacy.py +5 -5
  7. maloja/apis/listenbrainz.py +7 -5
  8. maloja/apis/native_v1.py +43 -26
  9. maloja/cleanup.py +9 -7
  10. maloja/data_files/config/rules/predefined/krateng_kpopgirlgroups.tsv +4 -2
  11. maloja/database/__init__.py +55 -23
  12. maloja/database/associated.py +10 -6
  13. maloja/database/exceptions.py +28 -3
  14. maloja/database/sqldb.py +216 -168
  15. maloja/dev/profiler.py +3 -4
  16. maloja/images.py +6 -0
  17. maloja/malojauri.py +2 -0
  18. maloja/pkg_global/conf.py +97 -72
  19. maloja/proccontrol/tasks/export.py +2 -1
  20. maloja/proccontrol/tasks/import_scrobbles.py +57 -15
  21. maloja/server.py +4 -5
  22. maloja/setup.py +56 -44
  23. maloja/thirdparty/lastfm.py +18 -17
  24. maloja/web/jinja/abstracts/base.jinja +1 -1
  25. maloja/web/jinja/admin_albumless.jinja +2 -0
  26. maloja/web/jinja/admin_overview.jinja +3 -3
  27. maloja/web/jinja/admin_setup.jinja +1 -1
  28. maloja/web/jinja/error.jinja +2 -2
  29. maloja/web/jinja/partials/album_showcase.jinja +1 -1
  30. maloja/web/jinja/partials/awards_album.jinja +1 -1
  31. maloja/web/jinja/partials/awards_artist.jinja +2 -2
  32. maloja/web/jinja/partials/charts_albums_tiles.jinja +4 -0
  33. maloja/web/jinja/partials/charts_artists_tiles.jinja +5 -1
  34. maloja/web/jinja/partials/charts_tracks_tiles.jinja +4 -0
  35. maloja/web/jinja/snippets/entityrow.jinja +2 -2
  36. maloja/web/jinja/snippets/links.jinja +3 -1
  37. maloja/web/static/css/maloja.css +14 -2
  38. maloja/web/static/css/startpage.css +2 -2
  39. maloja/web/static/js/manualscrobble.js +1 -1
  40. maloja/web/static/js/notifications.js +16 -8
  41. {malojaserver-3.2.1.dist-info → malojaserver-3.2.3.dist-info}/METADATA +10 -46
  42. {malojaserver-3.2.1.dist-info → malojaserver-3.2.3.dist-info}/RECORD +45 -45
  43. {malojaserver-3.2.1.dist-info → malojaserver-3.2.3.dist-info}/WHEEL +1 -1
  44. {malojaserver-3.2.1.dist-info → malojaserver-3.2.3.dist-info}/LICENSE +0 -0
  45. {malojaserver-3.2.1.dist-info → malojaserver-3.2.3.dist-info}/entry_points.txt +0 -0
@@ -19,12 +19,16 @@ def load_associated_rules():
19
19
 
20
20
  # load from file
21
21
  rawrules = []
22
- for f in os.listdir(data_dir["rules"]()):
23
- if f.split('.')[-1].lower() != 'tsv': continue
24
- filepath = data_dir["rules"](f)
25
- with open(filepath,'r') as filed:
26
- reader = csv.reader(filed,delimiter="\t")
27
- rawrules += [[col for col in entry if col] for entry in reader if len(entry)>0 and not entry[0].startswith('#')]
22
+ try:
23
+ for f in os.listdir(data_dir["rules"]()):
24
+ if f.split('.')[-1].lower() != 'tsv': continue
25
+ filepath = data_dir["rules"](f)
26
+ with open(filepath,'r') as filed:
27
+ reader = csv.reader(filed,delimiter="\t")
28
+ rawrules += [[col for col in entry if col] for entry in reader if len(entry)>0 and not entry[0].startswith('#')]
29
+ except FileNotFoundError:
30
+ return
31
+
28
32
  rules = [{'source_artist':r[1],'target_artist':r[2]} for r in rawrules if r[0]=="countas"]
29
33
 
30
34
  #for rule in rules:
@@ -1,37 +1,57 @@
1
1
  from bottle import HTTPError
2
2
 
3
+
3
4
  class EntityExists(Exception):
4
- def __init__(self,entitydict):
5
+ def __init__(self, entitydict):
5
6
  self.entitydict = entitydict
6
7
 
7
8
 
8
9
  class TrackExists(EntityExists):
9
10
  pass
10
11
 
12
+
11
13
  class ArtistExists(EntityExists):
12
14
  pass
13
15
 
16
+
14
17
  class AlbumExists(EntityExists):
15
18
  pass
16
19
 
20
+
21
+ # if the scrobbles dont match
22
+ class DuplicateTimestamp(Exception):
23
+ def __init__(self, existing_scrobble, rejected_scrobble):
24
+ self.existing_scrobble = existing_scrobble
25
+ self.rejected_scrobble = rejected_scrobble
26
+
27
+
28
+ # if it's the same scrobble
29
+ class DuplicateScrobble(Exception):
30
+ def __init__(self, scrobble):
31
+ self.scrobble = scrobble
32
+
33
+
17
34
  class DatabaseNotBuilt(HTTPError):
18
35
  def __init__(self):
19
36
  super().__init__(
20
37
  status=503,
21
38
  body="The Maloja Database is being upgraded to support new Maloja features. This could take a while.",
22
- headers={"Retry-After":120}
39
+ headers={"Retry-After": 120}
23
40
  )
24
41
 
25
42
 
26
43
  class MissingScrobbleParameters(Exception):
27
- def __init__(self,params=[]):
44
+ def __init__(self, params=[]):
28
45
  self.params = params
29
46
 
47
+
30
48
  class MissingEntityParameter(Exception):
31
49
  pass
32
50
 
51
+
33
52
  class EntityDoesNotExist(HTTPError):
34
53
  entitytype = 'Entity'
54
+
35
55
  def __init__(self,entitydict):
36
56
  self.entitydict = entitydict
37
57
  super().__init__(
@@ -39,9 +59,14 @@ class EntityDoesNotExist(HTTPError):
39
59
  body=f"The {self.entitytype} '{self.entitydict}' does not exist in the database."
40
60
  )
41
61
 
62
+
42
63
  class ArtistDoesNotExist(EntityDoesNotExist):
43
64
  entitytype = 'Artist'
65
+
66
+
44
67
  class AlbumDoesNotExist(EntityDoesNotExist):
45
68
  entitytype = 'Album'
69
+
70
+
46
71
  class TrackDoesNotExist(EntityDoesNotExist):
47
72
  entitytype = 'Track'