This commit is contained in:
13
PROJECT.org
13
PROJECT.org
@ -88,7 +88,7 @@ fetching and simple saving.
|
|||||||
*** Metadata sources
|
*** Metadata sources
|
||||||
**** Scraper
|
**** Scraper
|
||||||
|
|
||||||
* Backlog [0/14] :vrobbler:project:personal:
|
* Backlog [1/15] :vrobbler:project:personal:
|
||||||
** TODO [#C] Create small utility to clean up tracks scrobbled with wonky playback times :vrobbler:personal:bug:music:scrobbles:
|
** TODO [#C] Create small utility to clean up tracks scrobbled with wonky playback times :vrobbler:personal:bug:music:scrobbles:
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:ID: 702462cf-d54b-48c6-8a7c-78b8de751deb
|
:ID: 702462cf-d54b-48c6-8a7c-78b8de751deb
|
||||||
@ -518,6 +518,17 @@ log a warning and move on.
|
|||||||
We should have a global view `/favorites/` that shows the logged in users's
|
We should have a global view `/favorites/` that shows the logged in users's
|
||||||
favorited media objects.
|
favorited media objects.
|
||||||
|
|
||||||
|
** DONE [#A] Fix scrobbling comic books :books:scrobbles:bug:
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: 8dfbff19-3fa4-f3b8-21c7-7a416498000c
|
||||||
|
:END:
|
||||||
|
|
||||||
|
*** Description
|
||||||
|
|
||||||
|
At some point logdata and log got confused, and now when you try
|
||||||
|
to scrobble a comic book, it just throws errors. We should look
|
||||||
|
into where the confusion happened and fix it.
|
||||||
|
|
||||||
* Version 51.0 [3/3]
|
* Version 51.0 [3/3]
|
||||||
** DONE [#B] Fix koreader scrobble imports to use DST properly :bug:books:imports:
|
** DONE [#B] Fix koreader scrobble imports to use DST properly :bug:books:imports:
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
|
|||||||
@ -225,7 +225,9 @@ class KoReaderImport(BaseFileImportMixin):
|
|||||||
|
|
||||||
self.mark_started()
|
self.mark_started()
|
||||||
try:
|
try:
|
||||||
scrobbles = process_koreader_sqlite_file(self.upload_file_path, self.user.id)
|
scrobbles = process_koreader_sqlite_file(
|
||||||
|
self.upload_file_path, self.user.id
|
||||||
|
)
|
||||||
self.record_log(scrobbles)
|
self.record_log(scrobbles)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.record_error(f"Import failed: {e}")
|
self.record_error(f"Import failed: {e}")
|
||||||
@ -272,7 +274,9 @@ class AudioScrobblerTSVImport(BaseFileImportMixin):
|
|||||||
|
|
||||||
self.mark_started()
|
self.mark_started()
|
||||||
try:
|
try:
|
||||||
scrobbles = import_audioscrobbler_tsv_file(self.upload_file_path, self.user.id)
|
scrobbles = import_audioscrobbler_tsv_file(
|
||||||
|
self.upload_file_path, self.user.id
|
||||||
|
)
|
||||||
self.record_log(scrobbles)
|
self.record_log(scrobbles)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.record_error(f"Import failed: {e}")
|
self.record_error(f"Import failed: {e}")
|
||||||
@ -936,6 +940,8 @@ class Scrobble(TimeStampedModel):
|
|||||||
logdata_cls = logdata.BaseLogData
|
logdata_cls = logdata.BaseLogData
|
||||||
|
|
||||||
log_dict = self.log
|
log_dict = self.log
|
||||||
|
if isinstance(log_dict, logdata.BaseLogData):
|
||||||
|
log_dict = log_dict.asdict
|
||||||
if isinstance(self.log, str):
|
if isinstance(self.log, str):
|
||||||
# There's nothing stopping django from saving a string in a JSONField :(
|
# There's nothing stopping django from saving a string in a JSONField :(
|
||||||
logger.warning(
|
logger.warning(
|
||||||
@ -1440,7 +1446,7 @@ class Scrobble(TimeStampedModel):
|
|||||||
start_ts=int(timezone.now().timestamp()),
|
start_ts=int(timezone.now().timestamp()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
).asdict
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"[scrobbling] creating new scrobble",
|
f"[scrobbling] creating new scrobble",
|
||||||
@ -1455,7 +1461,7 @@ class Scrobble(TimeStampedModel):
|
|||||||
"calories", None
|
"calories", None
|
||||||
):
|
):
|
||||||
if media.calories:
|
if media.calories:
|
||||||
scrobble_data["log"] = FoodLogData(calories=media.calories)
|
scrobble_data["log"] = FoodLogData(calories=media.calories).asdict
|
||||||
|
|
||||||
scrobble = cls.create(scrobble_data)
|
scrobble = cls.create(scrobble_data)
|
||||||
return scrobble
|
return scrobble
|
||||||
@ -1778,7 +1784,7 @@ class Scrobble(TimeStampedModel):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def calculate_reading_stats(self, commit=True):
|
def calculate_reading_stats(self, commit=True):
|
||||||
page_data = self.log.get("page_data")
|
page_data = self.logdata.page_data
|
||||||
|
|
||||||
if page_data:
|
if page_data:
|
||||||
if isinstance(page_data, dict):
|
if isinstance(page_data, dict):
|
||||||
@ -1838,9 +1844,7 @@ class FavoriteMedia(TimeStampedModel):
|
|||||||
birding_location = models.ForeignKey(
|
birding_location = models.ForeignKey(
|
||||||
BirdingLocation, on_delete=models.CASCADE, **BNULL
|
BirdingLocation, on_delete=models.CASCADE, **BNULL
|
||||||
)
|
)
|
||||||
media_type = models.CharField(
|
media_type = models.CharField(max_length=20, choices=Scrobble.MediaType.choices)
|
||||||
max_length=20, choices=Scrobble.MediaType.choices
|
|
||||||
)
|
|
||||||
sent_to_mopidy = models.BooleanField(default=False)
|
sent_to_mopidy = models.BooleanField(default=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
Reference in New Issue
Block a user