mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Happy New Year!
This commit is contained in:
parent
ac8abd4cb6
commit
4d06a327e9
@ -9,25 +9,15 @@ from doreah.settings import get_settings
|
|||||||
|
|
||||||
OFFSET = get_settings("TIMEZONE")
|
OFFSET = get_settings("TIMEZONE")
|
||||||
TIMEZONE = timezone(timedelta(hours=OFFSET))
|
TIMEZONE = timezone(timedelta(hours=OFFSET))
|
||||||
|
UTC = datetime.timezone.utc
|
||||||
|
|
||||||
FIRST_SCROBBLE = int(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).timestamp())
|
FIRST_SCROBBLE = int(datetime.datetime.utcnow().replace(tzinfo=UTC).timestamp())
|
||||||
|
|
||||||
def register_scrobbletime(timestamp):
|
def register_scrobbletime(timestamp):
|
||||||
global FIRST_SCROBBLE
|
global FIRST_SCROBBLE
|
||||||
if timestamp < FIRST_SCROBBLE:
|
if timestamp < FIRST_SCROBBLE:
|
||||||
FIRST_SCROBBLE = int(timestamp)
|
FIRST_SCROBBLE = int(timestamp)
|
||||||
|
|
||||||
def start_of_scrobbling():
|
|
||||||
global FIRST_SCROBBLE
|
|
||||||
f = datetime.datetime.utcfromtimestamp(FIRST_SCROBBLE)
|
|
||||||
return [f.year]
|
|
||||||
|
|
||||||
def end_of_scrobbling():
|
|
||||||
global FIRST_SCROBBLE
|
|
||||||
f = datetime.datetime.now()
|
|
||||||
return [f.year]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -67,7 +57,7 @@ class MRangeDescriptor:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def uri(self):
|
def uri(self):
|
||||||
return "&".join(k + "=" + self.urikeys[k] for k in self.urikeys)
|
return "&".join(k + "=" + self.urikeys()[k] for k in self.urikeys())
|
||||||
|
|
||||||
def unlimited(self):
|
def unlimited(self):
|
||||||
return False
|
return False
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from ..__pkginfo__ import version
|
from ..__pkginfo__ import version
|
||||||
|
from ..malojatime import ranges, thisweek, thisyear
|
||||||
|
|
||||||
from doreah.regular import yearly, daily
|
from doreah.regular import yearly, daily
|
||||||
from doreah import settings
|
from doreah import settings
|
||||||
@ -51,19 +52,15 @@ def update_medals():
|
|||||||
|
|
||||||
from ..database import MEDALS, MEDALS_TRACKS, STAMPS, get_charts_artists, get_charts_tracks
|
from ..database import MEDALS, MEDALS_TRACKS, STAMPS, get_charts_artists, get_charts_tracks
|
||||||
|
|
||||||
currentyear = datetime.datetime.utcnow().year
|
|
||||||
try:
|
|
||||||
firstyear = datetime.datetime.utcfromtimestamp(STAMPS[0]).year
|
|
||||||
except:
|
|
||||||
firstyear = currentyear
|
|
||||||
|
|
||||||
|
|
||||||
MEDALS.clear()
|
MEDALS.clear()
|
||||||
MEDALS_TRACKS.clear()
|
MEDALS_TRACKS.clear()
|
||||||
|
|
||||||
for year in range(firstyear,currentyear):
|
for year in ranges(step="year"):
|
||||||
charts_artists = get_charts_artists(within=[year])
|
if year == thisyear(): break
|
||||||
charts_tracks = get_charts_tracks(within=[year])
|
|
||||||
|
charts_artists = get_charts_artists(timerange=year)
|
||||||
|
charts_tracks = get_charts_tracks(timerange=year)
|
||||||
|
|
||||||
collect_rankings(charts_artists,get_artist,MEDALS,iteration=year,count=False)
|
collect_rankings(charts_artists,get_artist,MEDALS,iteration=year,count=False)
|
||||||
collect_rankings(charts_tracks,get_track,MEDALS_TRACKS,iteration=year,count=False)
|
collect_rankings(charts_tracks,get_track,MEDALS_TRACKS,iteration=year,count=False)
|
||||||
@ -73,7 +70,6 @@ def update_medals():
|
|||||||
def update_weekly():
|
def update_weekly():
|
||||||
|
|
||||||
from ..database import WEEKLY_TOPTRACKS, WEEKLY_TOPARTISTS, get_charts_artists, get_charts_tracks
|
from ..database import WEEKLY_TOPTRACKS, WEEKLY_TOPARTISTS, get_charts_artists, get_charts_tracks
|
||||||
from ..malojatime import ranges, thisweek
|
|
||||||
|
|
||||||
|
|
||||||
WEEKLY_TOPARTISTS.clear()
|
WEEKLY_TOPARTISTS.clear()
|
||||||
|
Loading…
Reference in New Issue
Block a user