Compare commits

...

1130 Commits
0.4.0 ... 23

Author SHA1 Message Date
1a1de02843 [release] 23 2025-08-17 12:41:10 -04:00
a1868e7b2c [project] Updating TODOs 2025-08-17 12:38:27 -04:00
52494651bf [scrobbles] Add dynamic forms for LogData classes 2025-08-17 12:38:11 -04:00
1093aa2376 [music] Fix getting album when duplicated name 2025-08-06 12:40:10 -04:00
d1f04c15a9 [music] Fix breaking on w. 2025-08-06 11:03:40 -04:00
fd3487c225 [tasks] A few little clean ups 2025-08-06 10:59:32 -04:00
df91526b0c [videogames] Fix showing platform in logdata 2025-08-05 10:18:10 -04:00
70f103db6f [boardgames] Remove print statements 2025-08-05 02:04:17 -04:00
b0b32821e3 [scrobbles] Clean up todoist logs too 2025-08-05 02:04:07 -04:00
278cab32ea [scrobbles] Start cleaning up logdata 2025-08-05 02:01:31 -04:00
06e075553a [scrobbles] CLean up some dataclasses 2025-08-05 01:56:20 -04:00
833368c8d7 [profiles] Clean up default task lookup 2025-08-05 01:56:03 -04:00
f70bab30d0 [scrobbles] Log errors when parsing fails 2025-08-05 00:13:44 -04:00
f230af89eb [videogames] Add scrobbles to views 2025-08-05 00:13:08 -04:00
bbc27209ab [templates] Clean up long play nonsense for video games 2025-08-05 00:12:47 -04:00
b7638c648a [templates] Fix video game detail page 2025-08-04 19:57:06 -04:00
c8926cf887 [scrobbles] Fix bug in mixin import 2025-08-03 11:33:44 -04:00
b8dd3ee258 [tests] Shim to fix broken import 2025-08-03 11:13:23 -04:00
dc965687c2 [puzzles] Add puzzles to homepage 2025-08-03 02:01:29 -04:00
ebc66bbf64 [puzzles] Add templates 2025-08-03 02:00:26 -04:00
d04db0ecb5 [scrobbles] Fix dataclass parsing and add puzzles to urls 2025-08-03 01:59:56 -04:00
fc72b23b11 [music] Fix timezones for TSV imports 2025-08-02 23:35:22 -04:00
a681b4d63b [notifications] Fix a few typos 2025-07-30 18:34:22 -04:00
c452ac24e0 [notifications] Send mood check-in 2025-07-30 18:30:18 -04:00
ae889bff7d [tasks] Fix bug in note str method 2025-07-30 17:50:59 -04:00
99dc86dc27 [moods] Fix mood list view 2025-07-30 16:05:48 -04:00
8eefcb8290 [tasks] Fix emacs metadata 2025-07-30 16:05:34 -04:00
ad0f9a54d0 [tasks] Fix dataclass models 2025-07-30 15:46:18 -04:00
1531b77b5c [tests] Fix metadata test 2025-07-30 13:59:11 -04:00
9437fdba60 [scrobbles] Fix log data parsing for tasks and boardgames
Add pagination to task and board game detail pages
2025-07-30 11:37:57 -04:00
a7551ef162 [music] Weird hack to get timezone for LFM scrobbles
Last.fm seems to send timestamps for scrobbles with a timezone of UTC
but the actual timezone is already localized. But that means we can't
extract the timezone we want, even though the timestamp is already in
the right timezone for storage.
2025-07-28 10:52:02 -04:00
c20204a6ea [music] Turns out lastfm already has our timeszone 2025-07-28 09:14:25 -04:00
685de842ea [views] Fix showing only a users scrobbles 2025-07-26 21:31:44 -04:00
7d13967708 [scrobbles] Fix admin filtering 2025-07-26 20:57:23 -04:00
109697a746 [project] Bump version 2025-07-26 10:19:34 -04:00
dde28f4aff [importers] Fix setting timezones before all imports 2025-07-26 10:18:43 -04:00
2f6ed3770f [books] Fix bad import after moving webdav to importers 2025-07-26 01:49:37 -04:00
e3d1cfb838 [books] Fix webdav importer 2025-07-25 23:40:39 -04:00
1821ac0d7b [project] Update tasks 2025-07-25 22:55:33 -04:00
4eb8289e55 [scrobbles] LastFM only creates import if there are imports 2025-07-25 22:53:31 -04:00
66e805542c [scrobbles] Add notification to board game imports 2025-07-25 21:28:08 -04:00
f91b127a2c [scrobbles] Allow skipping checks for existing scrobbles 2025-07-25 17:36:19 -04:00
b2077678e2 [music] Fix timezones on lastfm imports 2025-07-25 17:35:56 -04:00
5427198185 [profiles] Just black 2025-07-25 17:35:10 -04:00
2bdba14cd6 [boardgames] Fix import from imap for timezones 2025-07-25 17:34:57 -04:00
95d8c4e4d6 [profiles] Clean up timezone stuff 2025-07-25 17:33:59 -04:00
6ab7745151 [music] Use found name to look it up 2025-07-25 10:50:00 -04:00
8b062a6c1d [music] Add tracks migration 2025-07-25 10:44:06 -04:00
cd48e7a402 [boardgames] Fix migration path 2025-07-25 10:40:53 -04:00
22830b0cea [profiles] Fix extra newline in one off 2025-07-25 10:24:33 -04:00
fd36034f6d [templates] Fix album use and local_timestamp 2025-07-25 10:21:20 -04:00
edf9fbd9c1 [music] Reorganize importer and fix lookups 2025-07-25 10:20:49 -04:00
e8e989bb63 [music] Add albums to tracks and utility to condense tracks 2025-07-20 22:00:06 -04:00
69401d11c8 [importers] Reorganize importers a little 2025-07-20 16:43:50 -04:00
759caef45d [books] Move one off creator to profile utils 2025-07-20 16:31:20 -04:00
9514861b32 [tests] Skip failing tests 2025-07-19 21:09:51 -04:00
aa644aa9cf [project] Start adding features and update todos 2025-07-19 01:56:23 -04:00
94820b1d9c [scrobbles] Exclude geolocs from stop notifications 2025-07-19 01:56:03 -04:00
4db8793d5c [books] Allow timezone changes when importing from KOReader
Turns out you need a city-based timezone for DST stuff to work properly.
The US/Eastern timezone doesn't mess with DST because it can be so wonky
in different regions. So while we fix timezone defaulting to a
DST-friendly timezone too.
2025-07-19 01:54:27 -04:00
7c6e895ae4 [books] Start cleaning up get_from_google method 2025-07-09 13:46:06 -04:00
b1b67528bf [music] Fix find_or_create for tracks 2025-07-09 13:39:10 -04:00
dd54a33159 [profiles] Remove paswords from admin 2025-07-06 11:26:38 -04:00
92c4f91e5a [boardgames] Add check for learning plays from BG stats 2025-07-06 10:02:14 -04:00
838b19e996 [boardgames] Remove expansion_ids key if not needed 2025-07-06 00:01:01 -04:00
3808277025 [boardgames] Add comments and bgstats_id to scrobbles 2025-07-05 23:55:00 -04:00
f64863f2bc [scrobblers] Connect designers to board games 2025-07-03 22:02:27 -04:00
2c199c0e93 [boardgames] Check if scrobble exists first 2025-07-03 20:19:30 -04:00
4924ef316f [scrobbles] Add a check for Garmin emails 2025-07-03 16:26:29 -04:00
64cb17e91f [scrobbles] Add management command for imap 2025-07-03 14:59:33 -04:00
1fd325823b [boardgames] Clean up email parser to work with many plays 2025-07-03 00:34:51 -04:00
1590ce5f18 [boardgames] Adding email scrobbler for BG Stats 2025-07-02 23:01:13 -04:00
3548c29f97 [people] Add a more general people app 2025-07-02 11:00:06 -04:00
0fa831fa42 [boardgames] Start adding email scrobbling for board games 2025-07-02 10:55:24 -04:00
a2f64a98c3 [project] Update tasks 2025-07-02 10:29:13 -04:00
872ca17432 [tasks] Hackety hack 2025-07-02 09:29:15 -04:00
224c165d72 [tasks] Fix bad matching in label titles 2025-06-27 11:54:14 -04:00
bf7d2514f2 [tasks] Clean up param names and loggin 2025-06-27 11:50:30 -04:00
4e37bc5ab9 [tasks] Fix bug in looking up user profile 2025-06-27 11:42:37 -04:00
125da84f4e [tasks] Fix emacs scrobbling of tasks 2025-06-27 11:32:09 -04:00
36ceb4c7fe [release] 17.1 2025-06-27 10:52:50 -04:00
88a3831975 [tasks] Make tasks use user profile string 2025-06-27 10:48:05 -04:00
63361964ca [tasks] Add optional user context labels to get title 2025-06-27 10:37:09 -04:00
40b54b27f4 [tasks] Actually add the new utils file 2025-06-26 14:50:11 -04:00
a7eca4b9a7 [tasks] Actually get title consistently 2025-06-26 14:09:17 -04:00
d152412e99 [books] Add optional details key to log data for books 2025-06-25 10:21:26 -04:00
3ba6c6b6e4 [project] Add new bug in tasks
Though honestly, it will probably be a config setting in the Emacs hook,
but we'll see. Actually, maybe the emacs hook code should end up in this
repo somewhere 🤔
2025-06-24 14:25:20 -04:00
bffbf47c2f [release] 17.0 2025-06-24 10:56:14 -04:00
f4e81da533 [project] Completing task for label bug 2025-06-24 10:55:01 -04:00
4b7f5459be [project] Add new task for TV series bug 2025-06-24 10:53:57 -04:00
c68b0e9d7e [tasks] Fix bug in emacs labels 2025-06-24 10:52:47 -04:00
32ec65116b [tasks] Move to single context for task titles 2025-06-22 21:26:20 -04:00
da8d26fcd9 [trails] Add alltrails and gaiagps ids to model 2025-06-22 20:26:37 -04:00
d33954e494 [project] Tidy up todos 2025-06-17 10:53:26 -04:00
1b306d6493 [project] Move todos.org file to PROJECT.org 2025-06-17 10:50:30 -04:00
c881143e1b [todos] Update backlog with tasks from Todoist 2025-06-17 10:18:48 -04:00
141700fcb3 [music] Fixes RYM slug including commas 2025-06-16 09:38:19 -04:00
7357b5bfec [todos] Update todo formatting 2025-06-16 09:35:30 -04:00
99cabd0007 [todos] Finish another task! 2025-06-13 12:35:24 -04:00
cf77e12cc3 [tasks] Add description of task to the template 2025-06-13 12:34:55 -04:00
3f2cbbb34a [videos] Fix TMDB lookup for movies 2025-06-13 12:10:43 -04:00
650ecf12c6 Merge branch 'main' into develop 2025-06-13 11:55:04 -04:00
d7cc009d07 [ci] Make deploys on happen on tags 2025-06-13 11:52:14 -04:00
a872cf3611 [templates] Use TMDB rating ID if available 2025-06-13 11:47:42 -04:00
1f9713312b [videos] Fix lookup for mevie posters 2025-06-13 11:47:04 -04:00
159e555d7c [templates] Remove global counts from home page 2025-06-13 11:33:21 -04:00
981f4f9c9a [videos] Quick fix 2025-06-13 11:23:37 -04:00
ddd5ce1392 Merge branch 'develop' 2025-06-13 11:21:07 -04:00
7a75b31b56 [todos] Update task for metadata fixing 2025-06-13 11:20:34 -04:00
24ac545f55 [videos] Switch to TMDB for scraping videos 2025-06-13 11:19:15 -04:00
d5da8ae701 [todos] Update priority task 2025-06-13 09:43:08 -04:00
53a04d064d [videos] At least stop IMDB from breaking 2025-06-13 09:15:48 -04:00
c0871a3b9e [scrobbles] Fix failing tests 2025-06-12 09:57:32 -04:00
d917dd8b2c [tasks] Fix source checking for emacs/orgmode tasks when updating 2025-06-12 09:54:16 -04:00
6fc8084f2d [scrobbles] Fix log of media type 2025-06-11 12:01:02 -04:00
41d6fe8ff6 [todos] Add new task 2025-06-10 11:27:37 -04:00
73838312cd [tasks] Clean up emacs webhook flow 2025-06-10 11:06:47 -04:00
eb2dd4c839 [todos] Clean up todos and add new milestone 17 2025-06-10 10:05:40 -04:00
1a0c4f69f0 Merge branch 'develop' 2025-06-09 11:26:25 -04:00
356e579558 [brickset] Little fix to scrobble of bricksets 2025-06-09 10:40:12 -04:00
e980e3c5c9 [brickset] Fix manual scrobbling and admin 2025-06-09 10:36:13 -04:00
8773542099 [tasks] Fix source being orgmode not emacs 2025-06-08 03:05:43 -04:00
70378c9968 [tasks] Fix updating and stopping tasks from Emacs 2025-06-08 02:40:07 -04:00
c871087496 [tasks] First try at adding an emacs webhook 2025-06-08 01:09:03 -04:00
059d7780a0 [templates] Add counts and durations to new tables 2025-06-07 20:02:21 -04:00
db36329011 Merge branch 'develop' 2025-06-07 18:11:08 -04:00
69aa80e6c1 [templates] Allow going back and forward in time 2025-06-07 15:17:56 -04:00
99a6e5107b [scrobbles] Add orgparse and start of emacs webhook 2025-06-06 17:25:04 -04:00
39e2fdce27 [music] Fix allmusic lookup 2025-06-06 17:24:41 -04:00
b2f98d780b [middleware] Add auto timezone setting 2025-06-06 09:49:53 -04:00
07b5dc6a2c [templates] Clean up dashboard 2025-06-06 09:49:08 -04:00
7207ca385e [scrobbles] Add two new methods to Scrobble model 2025-06-06 09:48:15 -04:00
2a254e28d0 [templates] Start redesigning the dashboard 2025-05-18 23:20:47 -04:00
d4377e49ac [music] Fix getting album metadata 2025-05-18 23:19:17 -04:00
9dc0a818ff [templates] Fix chart loading 2025-05-18 23:19:05 -04:00
5e672fc9ed [webpages] Add title to webpage reading 2025-05-18 09:37:53 -04:00
6d194d227e Merge branch 'develop' 2025-05-11 01:43:55 -04:00
ed217cbad2 [beers] Blacken and clean up imports 2025-05-11 01:42:30 -04:00
3cca30dc70 [puzzles] Add puzzle lookup via IPDB 2025-05-11 01:41:43 -04:00
d3a15d5e7b Merge branch 'develop' 2025-05-11 00:03:48 -04:00
deeaa0af4b [puzzles] Fix misnamed ipdb field 2025-05-10 23:58:44 -04:00
159459e1b9 [puzzles] Add puzzle model and hooks 2025-05-10 23:48:40 -04:00
89b6d8de06 [importers] Fixes TSV comma missing 2025-05-10 23:48:40 -04:00
3c725de2ac [webpages] Fixes 500 errors when webpage lookup fails 2025-05-10 23:48:40 -04:00
dd71bdd38c [puzzles] Add puzzle model and hooks 2025-05-10 23:36:03 -04:00
d066a98282 [importers] Fixes TSV comma missing 2025-04-15 16:32:14 -04:00
73bc4a1cd1 [webpages] Fixes 500 errors when webpage lookup fails 2025-04-15 16:18:26 -04:00
79d58e6390 Merge branch 'develop' 2025-04-07 17:45:16 -04:00
69e9caf477 [release] Bump version to 0.16.1 2025-04-07 17:43:36 -04:00
776e839ca4 [ci] Fixes wrong public key 2025-04-07 17:42:31 -04:00
97792898df [release] Bump version to 0.16.0 2025-04-07 17:34:00 -04:00
9986163d20 [notifications] Fixes missing title 2025-04-07 17:34:00 -04:00
d1229585a1 [release] Bump version to 0.16.0 2025-04-07 17:31:50 -04:00
b8c5c3f3e9 Merge branch 'main' into develop 2025-04-07 16:57:54 -04:00
6d9e237f9b [notifications] Fixes missing title 2025-04-07 16:53:30 -04:00
e65a2d300d [ci] Fixes reference to wrong ssh key 2025-04-07 14:38:46 -04:00
f45541de6d [deps] Fixes premature bump to py312
Turns out our deployment uses python 3.11, so we need to roll back
the pillow and pendulum upgrades so they work with python 3.11 ... how
irritating to have all this version bump nonesense.
2025-04-07 14:27:28 -04:00
391f0cc335 [tests] Trying to parallel tests 2025-04-07 13:55:42 -04:00
4b5281bdd8 [cleaning] Adding migrations that are past due 2025-04-07 13:47:21 -04:00
484be0a64e [tests] Skip openlibrary lookup tests 2025-04-07 13:45:13 -04:00
257e6899d3 [tests] Clean up podcast tests 2025-04-07 13:40:32 -04:00
4767cc7e52 [podcasts] Fixes enrichment of podcasts with podcastindex 2025-04-07 13:32:03 -04:00
bcc3f46806 [tests] We dont differentiate on albums anymore 2025-04-07 12:39:57 -04:00
6c461ed55f [tests] Simplify view tests to not mess with time 2025-04-07 12:30:54 -04:00
28cf57c6dd [tests] Try fixing CI breaking with small seconds 2025-04-07 09:56:10 -04:00
0bb874f1db [scrobblers] Fixes test with wiggly second 2025-04-07 00:12:29 -04:00
27f50baf5d [music] Fixes missing jellyfin ts converter 2025-04-06 23:39:32 -04:00
499c3d6859 [music] Fix bug in scobblers for tracks 2025-04-06 22:40:33 -04:00
b0e9f13e11 [music] Attempts to fix bad lookups from LastFM and Jellyfin
Broader issue was creating tracks without albums that were duplicates of
existing tracks because sometimes Jellyfin and LastFM do not have albums
sent with them.
2025-04-06 22:28:32 -04:00
b2ee79b3ea [project] Update TODOs file 2025-04-04 11:00:28 -04:00
3ddd3b1684 [deps] Upgrades pillow to work with Python 3.11 2025-04-04 10:23:41 -04:00
4f8a359ab9 [deps] Upgrades pendulum to work with python 3.13 2025-04-02 22:14:24 -04:00
48114aee5e [scrobblers] Fix missing r in regex string 2025-04-02 22:14:11 -04:00
0cc87a2dbe [profiles] Add user profile context override 2025-04-02 22:13:43 -04:00
23d3e19db9 [scrobbles] Fixes typo in transaction import 2025-03-29 13:56:20 -04:00
29f5e2b940 [scrobbles] Add action parsing to scrobble url parsing
This also elaborates on the web scrobbler endpoint, though it does not
actually work at this time. But I'm tired of carrying this around in
stashes, so we'll push it and fix it later.
2025-03-29 13:52:46 -04:00
3208a32ffe [scrobbles] Fixes dedup utility, adding a transaction
Deleting tracks needs to be in a transaction so we don't try to delete a
track that may still have scrobbles associated with it.
2025-03-29 13:49:54 -04:00
99da9b62bf [music] Fixes bug where lastfm created new tracks
The issue here was that if we couldn't find a track from a musicbrainz
ID (which was almost never), we would fall back to just creating a new
track with a blank album. So we'd spam the track table with identical
tracks just no albums.

Now we do a quick check for the track where the title and artist match
and use that if it's found. This will result in some tracks being
associated with the wrong album, but I think that's better than the
current behavior.
2025-03-29 13:47:45 -04:00
36048d9a0a [music] Cleans up last.fm import logging
We weren't tracking import info very well in the original flow, this
should provide better insight into what happened after a run.
2025-03-29 13:44:48 -04:00
16091c9053 [tests] Skips the podcast scrobble tests, no Google Podcast 2025-03-27 16:50:42 -04:00
eec00ce658 [urls] Removes accidentaly committed URL updates
The modern_ui app is not ready yet, still sitting on a dev machine.

These url paths should not have been committed, so we'll just comment
them out for now.
2025-03-27 16:38:34 -04:00
e02010e409 [videos] Fix skip for youtube tests 2025-03-27 16:35:23 -04:00
498712e531 [drone] Update drone to install with test, rather than dev 2025-03-27 16:32:33 -04:00
14e4432495 [poetry] Update pyproject to only install test deps when needed
We'll also need to fast follow this with a new line in the drone
file otherwise CI will fail because pytest wont be installed by default
any longer.
2025-03-27 16:31:44 -04:00
676c40176c [notifications] Add a class for notifications 2025-03-25 09:50:14 -04:00
0a50bca622 [notifications] Add stop notification utility 2025-03-24 13:23:33 -04:00
ac9fc315b1 [books] Fix date lookup and literal string title search 2025-03-19 01:02:39 -04:00
50d1a4a2bd [videos] Fix youtube videos longer than an hour 2025-03-19 00:17:21 -04:00
444562235f [webpages] Handle title truncation better 2025-03-07 14:36:35 -05:00
760575e41d [webpages] Bail if we can't get text 2025-03-07 14:33:02 -05:00
42699f84d2 [tasks] Finish task based on timestamp, not now 2025-03-07 09:02:29 -05:00
b660e47bc2 [videos] Just a little type hinting 2025-02-25 21:09:02 -05:00
06b4ba8bcc [foods] Fix image bug in foods 2025-02-25 21:08:34 -05:00
1f67207f81 [books] Fix two bugs in looking up books 2025-02-25 21:07:45 -05:00
baa8dbee46 [boardgames] Modularize the Lichess imports 2025-02-25 11:09:29 -05:00
3f9cdcac65 [books] Clean up old page model and bug in page calc 2025-02-25 10:34:08 -05:00
71874510a4 [profiles] Actually make the form work 2025-02-25 01:17:12 -05:00
8c600d6b4b [books] Fix no result for detail lookup 2025-02-23 23:08:47 -05:00
e95b6f50dc [tests] Fix views and comment out youtube 2025-02-23 22:49:44 -05:00
93c16d80ec [profiles] Add settings form 2025-02-23 22:49:18 -05:00
b03da9ab37 [middleware] Add health check middleware 2025-02-21 10:40:44 -05:00
09ca05cb4f [make] Move deploys back to homelab 2025-02-20 23:27:47 -05:00
d6e02d241c [settings] Fix test settings 2025-02-20 23:27:31 -05:00
8dd94e2fc4 [books] Fix book admin 2025-02-20 23:27:22 -05:00
9e3f714c61 [books] Add papers as a data model 2025-02-20 23:07:56 -05:00
e2b0decd83 [utils] Add commit option to the dedupper 2025-02-17 17:36:43 -05:00
e08db5e3ad [github] Change when actions run 2025-02-10 09:33:38 -05:00
1460b9ba77 Fix py version for github actions 2025-02-10 09:32:07 -05:00
a41e0ffa5d Create django.yml for Github Actions 2025-02-10 09:30:34 -05:00
c51c75b6a6 [books] Handle authors from Google 2025-02-09 22:44:11 -05:00
041435bc93 [books] Use google and title to get book 2025-02-09 21:58:03 -05:00
15f27b73a5 [videos] Fix error where we add tt to the IMDB id 2025-02-03 00:32:22 -05:00
25900a9911 [boardgames] Send notifications on chess imports 2025-01-29 00:23:46 -05:00
4277e355e0 [boardgames] Few more little tweaks to imports 2025-01-29 00:19:40 -05:00
855f59b83f [boardgames] Fix small bug in black username 2025-01-29 00:08:55 -05:00
9c115c0b65 [boardgames] Add lichess importing 2025-01-29 00:04:49 -05:00
fd726a125f [books] Remove meta_yt references 2025-01-28 22:20:04 -05:00
6685669b29 [videos] Fix missing defaults for no tags 2025-01-27 14:58:47 -05:00
3fa43f02d0 [tasks] Add exercise and lifeevent to constants 2025-01-27 14:52:15 -05:00
66c34942e6 [videos] Youtube using the actual API 2025-01-27 14:51:56 -05:00
ef1fcd4026 [videos] Fix video type reference 2025-01-27 01:37:21 -05:00
a36efa3b1d [videos] Add check if youtube fails 2025-01-27 01:30:41 -05:00
300a2ae6aa [scrobblers] Add ability to stop via bookmarklet 2025-01-27 01:14:20 -05:00
1d5b91b6e2 [videos] Fix splitting youtube IDs 2025-01-27 00:41:03 -05:00
a5c67a7fe1 [videos] Clean up video tools 2025-01-26 23:41:41 -05:00
b16d0b1864 [vrobbler] Update poetry deps 2025-01-26 23:39:18 -05:00
f90a3b84a8 [books] Add google as a source and clean up data model 2025-01-26 23:39:02 -05:00
25a14ed9e7 [videos] Clean imdb getter up and fix series 2025-01-21 23:20:30 -05:00
84790c805c [migrations] Add default value to run time seconds 2025-01-21 23:20:09 -05:00
a9499f0463 [video] Fix youtube redirects 2025-01-21 22:49:15 -05:00
c109ed79eb [video] Update how we get video metadata for YT add 2025-01-20 09:13:18 -05:00
89e5455b29 [deps] Add meta-yt and updates 2024-11-25 13:55:30 -05:00
647762f201 [beers] Fix missing url path 2024-11-24 17:26:42 -05:00
b788cc65d1 [notifications] Fix finish url being on media 2024-11-24 09:59:18 -05:00
50ec82213c [foods] Fix migrations 2024-11-24 09:45:56 -05:00
51c1acd677 [notifications] Add click to finish 2024-11-24 09:39:44 -05:00
fd38046113 [foods] Add Food scrobbling 2024-11-20 14:16:44 -05:00
d294f2ecd1 [koreader] Fix list access bug 2024-11-19 20:46:25 -05:00
3c7940c6c6 [lastfm] Fix importing tracks 2024-11-18 15:12:20 -05:00
56c000154c [scrobbles] Simplify notifications and add to books 2024-11-18 14:40:05 -05:00
8157836b42 [lastfm] Fix issue with no media obj 2024-11-18 14:19:41 -05:00
af0e76b29c [utils] Add crud deduplicator 2024-11-17 22:02:19 -05:00
39004aac0c [make] Restart celery too 2024-11-17 21:01:43 -05:00
8cbd746681 [tasks] Fix import in utils 2024-11-17 21:00:27 -05:00
dee04a47cb [config] No need to load pypi pass everytime 2024-11-17 20:49:14 -05:00
1304a27408 [books] Add webdav koreader importer 2024-11-17 20:49:14 -05:00
2327b1f622 [notifications] Clean up emojis and fix priority 2024-11-08 10:51:44 -05:00
94fed8ae38 [tasks] Add research as a tag 2024-11-08 08:59:17 -05:00
042a26f148 [make] Add migrations to deploy 2024-11-06 14:50:15 -05:00
e606f0de01 [trails] Add trail and default activity type 2024-11-06 14:48:56 -05:00
ed2253cb6b [videos] Clean up admin stuff 2024-11-06 11:07:27 -05:00
9a1508b7a6 [videos] Add channel admin access 2024-11-06 11:03:16 -05:00
39f3a31847 [videos] Update youtubes stuff 2024-11-06 10:50:39 -05:00
f0b32961c1 [scrobbles] Can't just use subtitle for notifications 2024-11-06 09:00:21 -05:00
a08574b359 [videos] Add subtitle to notifications 2024-11-06 00:18:16 -05:00
26ebb4108d [videos] Try to fix auth on webhooks 2024-11-05 23:54:21 -05:00
1b95706f70 [videos] Add youtube scrobbling 2024-11-05 23:32:03 -05:00
b65ebbe397 [books] Fix koreader import with nul strings 2024-11-05 21:13:37 -05:00
0679af3029 [scrobbles] Fix if log does not exist 2024-11-05 18:47:34 -05:00
8888b42adf [scrobbles] Actually use notify str 2024-11-05 16:50:35 -05:00
b8d68739cf [scrobbles] Kidding, we use description 2024-11-05 16:46:14 -05:00
4c2b838d7b [scrobbles] Add details if we have them 2024-11-05 16:43:40 -05:00
cdb3c29844 [music] Fix timestamp setting in lastfm importer 2024-11-05 16:41:12 -05:00
22c07bdb82 [music] Fix lastfm importing 2024-11-05 16:33:28 -05:00
66513c5758 [scrobbles] Memos 2024-11-05 16:28:58 -05:00
f3c0d20268 [scrobbles] Fix ntfy formatting 2024-11-05 16:27:16 -05:00
622a30899f [music] Fix how we create tracks from LastFM 2024-11-05 14:47:30 -05:00
2c1e8c08ae [scrobbles] Add ntfy config to user profiles 2024-11-05 14:38:01 -05:00
cc52e00d15 [videos] Fix utils 2024-11-04 20:40:49 -05:00
e762658082 [deps] Update howlongtobeatpy 2024-11-04 15:30:50 -05:00
5111cee14b [videogames] Fix minor metadata look up bug 2024-11-04 15:30:00 -05:00
68a6d58339 [tsv] Try fixing our lookup when titla and MB id are none 2024-11-04 10:18:52 -05:00
b91c8b27d7 [tsv] Fix lookup to use new dict method 2024-11-04 09:55:38 -05:00
3a91aa5903 [tsv] Fix missing comma error 2024-11-04 09:45:13 -05:00
bfd6331be3 [vidoes] default run time seconds to 1800 2024-11-03 11:31:13 -05:00
38ba474c1f [beers] Fix abv lookup 2024-11-02 18:59:11 -04:00
76272b7e39 [beers] Fix rating error 2024-11-01 22:42:42 -04:00
1f0c950b17 [beers] Fix missing abv error 2024-11-01 22:39:46 -04:00
f2998205e1 [tasks] Remove data class until we fix it 2024-11-01 16:03:20 -04:00
38e108c1ae [tasks] Trying to fix logdata 2024-11-01 15:58:16 -04:00
dec100f8ff [make] Add basic makefile 2024-11-01 15:55:21 -04:00
e89eb332d3 [task] Try to fix logdata for tasks 2024-11-01 15:55:07 -04:00
cb5b279300 [templates] Fix missing logdata model 2024-11-01 15:42:47 -04:00
59d681dc00 [task] Ooops, add task id 2024-11-01 13:10:47 -04:00
82dcad569a [task] Log when we don't find a task for notes 2024-11-01 12:48:59 -04:00
d8aaf3bf55 [task] Little bug 2024-11-01 12:43:18 -04:00
29b92d89b2 [task] Try to fix scrobbling 2024-11-01 12:35:11 -04:00
86bcdef13d [task] Fix small bug 2024-11-01 12:12:30 -04:00
20e6ae7421 [tasks] Update checking for inprogress changed 2024-11-01 12:08:06 -04:00
4ed5117900 [tasks] Stop ignoring notes 2024-11-01 11:16:24 -04:00
3388471685 [tasks] Don't stop tasks when modified while in progress 2024-10-31 15:28:06 -04:00
58a957c98a [tasks] Add ability to save comments as notes on tasks 2024-10-25 15:10:35 -04:00
2ad626cd59 [beers] Add subtitles 2024-10-23 12:59:18 -04:00
6ce0257dc0 [beers] Cleaning up 2024-10-23 12:57:45 -04:00
43dbd3b28b [beers] Fix description tag typo 2024-10-23 12:55:37 -04:00
7671644e87 [beers] Allow scrobbling from URLS 2024-10-23 12:48:55 -04:00
f555a49746 [beers] Fix untappd and beeradvocate urls 2024-10-23 10:58:07 -04:00
9fe474978a [beers] Add manual scrobbling from URLs 2024-10-23 10:51:35 -04:00
9f8465d364 [beers] Fix a few more display stuffs 2024-10-22 17:58:39 -04:00
ddfddc33f5 [beers] Actually give producers names 2024-10-22 17:52:18 -04:00
0ec7ed3a18 [beers] Finish out the model 2024-10-22 17:47:38 -04:00
0bda3f6fd8 [beers] Fix error in cover reference, add adminf or beer producers 2024-10-22 17:44:46 -04:00
59765b14ca [beers] Connect beers with producers 2024-10-22 17:34:20 -04:00
08b48371bc [beers] Add beer scrobbling 2024-10-22 17:26:55 -04:00
d3d5b088cd [webdav] Add basic client 2024-10-20 16:22:56 -04:00
083e931a78 [webdav] Add crednetials to user profile 2024-10-20 16:06:24 -04:00
0f0fb7cceb [scrobbles] Add lookup of last serial scrobble 2024-10-20 14:35:42 -04:00
f2bbb7f5d0 [scrobblers] Use udpated_at key for Todoist scrobbles 2024-10-20 14:29:17 -04:00
218c68dee0 [books] Fix importing scrobbles from existing books 2024-10-18 14:50:46 -04:00
202cf24722 [books] Clean up koreader imports and data storage 2024-10-18 12:49:59 -04:00
1ddacd4454 [scrobbles] Improve webhook logging 2024-10-17 22:51:10 -04:00
2dbb091d61 [books] Fix importing to not use OL by default for now 2024-10-17 16:40:07 -04:00
dbaf189628 [scrobbles] Fix scrobbling duplicate tasks 2024-10-15 21:29:50 -04:00
4a0bac5b87 [scrobbles] Fix double scrobbling tasks 2024-10-15 19:34:27 -04:00
59b7e3dada [scrobbles] Add description to current task 2024-10-15 15:29:31 -04:00
24223ebe13 [scrobbles] Add working to status page 2024-10-15 15:27:48 -04:00
de6e9ce2d6 [tasks] We only care about in-progress for scrobbling 2024-10-15 15:23:15 -04:00
470eb0778a [tasks] Get last task, not first 2024-10-15 15:14:37 -04:00
f075492554 [tasks] Add Bug as suffix type 2024-10-15 15:12:58 -04:00
8fb2fac47f [tasks] Remove in-progress tag to stop 2024-10-15 15:11:03 -04:00
b1eac1454b [tasks] Don't create new scrobbles for in progress tasks 2024-10-15 15:07:43 -04:00
84737e0c3b [tasks] Add habit to suffix type 2024-10-15 15:02:01 -04:00
c4359a2331 [tasks] Fix catch for no scrobble available 2024-10-15 14:58:34 -04:00
8fa538dbee [tasks] Fix use of source_id 2024-10-15 14:56:26 -04:00
26d82518fa [tasks] Temporarily don't use updated_at 2024-10-15 14:52:58 -04:00
04a7ba51e4 [tasks] Add user id to Profile 2024-10-15 14:49:43 -04:00
ccf14c51bf [tasks] Fix webhook creating duplicates 2024-10-15 14:41:40 -04:00
b97aa8936e [scrobbles] Fix if past seconds is zero 2024-10-15 14:40:05 -04:00
98924e362e [tasks] Fix loading todoist data from webhook data 2024-10-15 14:37:15 -04:00
0384f72cbd [tasks] Fix webhook for Todoist 2024-10-15 14:25:15 -04:00
0c8a486b6a [tasks] Implement todoist webhooks #8479861260 2024-10-15 14:21:30 -04:00
7954765b73 [tasks] Add oauth flow for Todoist 2024-10-14 22:15:29 -04:00
7604327ca9 [oauth] Adding oauth pattern 2024-10-14 18:13:27 -04:00
20542ac7e9 [scrobbles] Fix tasks overwriting tasks 2024-10-11 18:34:13 -04:00
34137af815 [videos] Fix series lookup from IDMB too 2024-10-09 21:08:04 -04:00
0f2570e51b [videos] Fix imdb dict lookups 2024-10-09 20:31:43 -04:00
ed917e16fc [scrobbles] Fix when scrobble has not dict 2024-10-07 16:50:54 -04:00
164510b7b7 [tasks] Add media url link 2024-10-05 17:59:32 -04:00
6764023016 [tasks] Fix capitalization call 2024-10-05 16:07:19 -04:00
7c6c1cee6d [tasks] Fix scrobbling tasks 2024-10-05 15:49:22 -04:00
c251c5f413 [tasks] Allow scrobbling tasks from URLs 2024-10-05 15:08:38 -04:00
342e86d7fb [videos] Don't lookup video when we know what it is 2024-10-05 14:33:25 -04:00
176b698f6e [templates] Clean up tables 2024-10-02 17:51:02 -04:00
ddf2ca5630 [scrobbling] Actually fix typo in mopidy uri 2024-10-02 17:51:00 -04:00
d52061f6d8 [scrobbling] Actually fix typo in mopidy uri 2024-10-02 15:40:16 -04:00
3c0a75755b [tasks] Fix source url generation 2024-09-30 17:10:28 -04:00
183469ebe5 [tasks] Add tasks app 2024-09-30 15:05:07 -04:00
bbe8149e6c [scrobbles] Fix scrobbling from IMDB urls 2024-09-26 22:12:58 -04:00
f876caabe1 [scrobblers] Add mopidy source to scrobbler 2024-09-26 22:07:01 -04:00
87c078f47d [scrobbles] Allow scrobbling any content via URLs 2024-09-26 21:58:40 -04:00
5a9292e10a [videos] Fix looking up on IMDB 2024-09-26 21:58:39 -04:00
a5630022f5 [status] Add pocast playing to listening status 2024-09-16 12:42:39 -04:00
babc2aeb9d [boardgames] Fix missing default None for serial scrobble 2024-09-14 09:34:07 -04:00
875b0f98a0 [scrobblers] Fix manual vidoe lookup and simplify Sports 2024-09-12 20:16:05 -04:00
5d1edc71d7 [scrobbles] Add gpx file for trails 2024-09-11 13:31:48 -04:00
e4738e464f [trails] Finish hooking things up for trails 2024-09-09 17:20:10 -04:00
85c4963619 [templates] Fix trail template loading 2024-09-09 17:07:13 -04:00
8d6707db95 [templates] Clean up redundent templates and fix main menu 2024-09-09 16:58:33 -04:00
0df3dd728d [release] Bump to version 0.15.4 2024-09-09 13:05:17 -04:00
1fe8d8aa51 [boardgames] Add better list template and fix URLs (also for moods) 2024-09-09 12:56:42 -04:00
8f3c7beffa [trails] Make trail admin raw ID field 2024-09-09 12:12:39 -04:00
aac0efbb14 [misc] Cleaning up imports and urls for webpages 2024-09-09 12:12:08 -04:00
b0d4dd0899 [trails] Add new trails app 2024-09-09 12:11:39 -04:00
16db67ea84 [bgg] Add rudimentary bgg push scrobble script 2024-09-09 11:56:42 -04:00
7a747268a1 [lifevents] Remove redundant completion percentage 2024-09-09 11:56:20 -04:00
2037ffc67a [deps] Add webdav client library and fix boto3 2024-09-09 11:55:58 -04:00
2136c1562a [books] Fix calculation of current page 2024-09-08 14:13:40 -04:00
eae169aff7 [version] Bump to version 0.15.3 2024-09-08 00:53:19 -04:00
6c0bd2e409 [scrobbles] Clean up references to book_page_data 2024-09-08 00:52:50 -04:00
d69d7311d5 [version] Bump to 0.15.2 2024-09-08 00:45:36 -04:00
c484dab210 [books] Fix importing order of page data 2024-09-08 00:44:55 -04:00
3d62a6a227 [videos] Fix error looking up TV shows 2024-09-07 23:07:39 -04:00
1a5d4a6717 [scrobbles] Clean up dataclass inheritence 2024-09-07 11:36:36 -04:00
8f0491a90b [pyproject] Upgrade version to 0.15.0 2024-09-07 11:04:01 -04:00
7e961076b4 [bricksets] Add brick set scrobble type 2024-09-07 02:02:16 -04:00
14062f3b60 [videos] Mock in youtube lookup 2024-09-06 11:02:48 -04:00
0a8acdf33f [videos] Add skatevideo lookup properly 2024-09-06 11:01:45 -04:00
b5d194e74f [music] Fix jellyfin music scrobbling sort of 2024-09-06 10:27:04 -04:00
3a50a8b015 [videos] Fixing imdb lookups and making it more modular 2024-09-06 01:22:54 -04:00
921cf9d8b3 [videogames] Add log data to VideoGame model 2024-08-21 11:09:15 -04:00
ba0be65ed0 [scrobbles] Allow boardgame screenshots and clean up koreader fields 2024-08-20 20:10:32 -04:00
caad6329c9 [scrobbles] Fixing tests and breaking more 2024-08-19 18:59:37 -04:00
cfd6ac861e [scrobbles] Fix datalog return value and message 2024-08-19 12:27:47 -04:00
ca36e25948 [scrobbles] Fix datalog test case for board games 2024-08-19 12:12:42 -04:00
c84acf6ae7 [boardgames] Add str rep for player dataclass 2024-08-19 10:14:10 -04:00
610464e732 [scrobbles] Fix serializing logdata 2024-08-19 10:00:07 -04:00
047dd22069 [moods] Add mood fixture data 2024-08-19 09:46:32 -04:00
2c73121367 [scrobbles] Fix aggregator tests 2024-08-19 09:45:16 -04:00
9affd6e03a [scrobbles] Add some tests around jellyfin and start cleaning up 2024-08-16 12:04:09 -04:00
b414bbf59c [templates] Fix status template logdata call 2024-08-12 00:03:52 -05:00
5e22cb3106 [scrobbling] Refactor webhook and simplify 2024-08-12 00:03:30 -05:00
cc9a2a64df [settings] Fix missing moods app in testing settings 2024-08-10 23:30:38 -04:00
c2b334b926 [moods] Fix missing init file 2024-08-10 23:28:36 -04:00
ad6f0e1b62 [deps] Update poetry reqs to fix HLTB bug 2024-08-10 23:10:26 -04:00
1df8157d8d [music] Fix error when mb fails 2024-08-10 23:10:11 -04:00
7d33e6afdb [scrobbles] Fix migrations 2024-08-10 22:35:37 -04:00
40d112c58c [music] Fix failure when musicbrainz has no track 2024-08-10 22:14:07 -04:00
cdfd8af078 [views] Clean up base scrobblable views 2024-08-10 22:12:36 -04:00
0ce19527a2 [scrobbles] Fix mood starting, and clean up code 2024-08-10 22:12:36 -04:00
f3fc58e2c0 [moods] Add moods 2024-08-10 22:12:24 -04:00
b02b75fa90 [boardgames] Add BGG username to user profile 2024-08-07 14:52:26 -03:00
b626ac583a [books] Move book metadata into the log field 2024-08-07 14:51:21 -03:00
adc10ab43b [lifeevents] Fix bad metadata reference 2024-08-06 11:52:35 -03:00
5555b1b89e [lifeevents] Fix data class bug 2024-08-06 11:46:22 -03:00
7fd90f8cf0 [lifeevents] Clean up life event status with details 2024-08-06 11:35:04 -03:00
f80daba67b [boardgames] Update metadata for board game scrobbles 2024-08-05 12:27:42 -03:00
8bd4fd1d4b [webpags] Redirect to webpage url when we're done 2024-08-04 00:20:22 -04:00
f30e416e8d [webpages] Actually add the forms file 2024-08-04 00:11:48 -04:00
f29a039562 [webpages] Provide default iframe reading method 2024-08-03 23:49:31 -04:00
882367cee6 [views] Actually speed up the dashboard view 2024-07-23 16:35:48 -04:00
74c32bc4d5 [views] Move elaborate charts to the charts page 2024-07-23 16:24:59 -04:00
dcd7196010 Fix drone ntfy version 2024-07-14 01:15:27 -04:00
2e57b2ce07 Add dataclass wizard and fix dataclasses 2024-07-03 23:22:19 -04:00
9d664ba476 Update metadata to use JSONWizard 2024-07-03 15:53:27 -04:00
0fa89af1d9 [scrobbles] Fix timestamp log marker for locations 2024-06-07 01:27:58 -04:00
2c5516ae4e [scrobbles] Add life events to status page 2024-05-23 21:21:58 -04:00
0cba46b103 [scrobbles] Fix how we get our redirect url 2024-05-23 21:20:02 -04:00
5014c4428b [scrobbles] Allow junk in the scrobble log 2024-05-23 00:42:01 -04:00
1d554429f1 [scrobbles] Add metadata accessor 2024-05-23 00:37:20 -04:00
daea268465 Fix display of life events 2024-05-23 00:26:56 -04:00
1cceb2bd63 [lifeevents] Add metadata dataclasses 2024-05-23 00:16:24 -04:00
e15d253d58 [lifeevents] Add life events to scrobbles 2024-05-23 00:14:06 -04:00
8ed0bd3d21 [locations] Fix gps update log format 2024-05-05 22:13:15 -04:00
113f200eb7 [scrobbles] Move scrobble_log to log 2024-05-05 22:09:21 -04:00
1b5ffd2a3c [scrobbles] Fix pendulum bug 2024-04-24 14:06:49 -07:00
f168608cee [scrobbles] Fix scrobbling apocalypse 2024-04-22 14:27:33 -04:00
c28f93a1bb [scrobbles] Little reorg and trying to fix JF stop issue 2024-04-22 14:05:42 -04:00
99ad2f797f [scrobbles] Try to fix Jellyfin stop bug 2024-04-22 12:55:14 -04:00
1f28179ed1 [music] Fix lastfm import missing timezones 2024-04-21 22:36:21 -04:00
1648f988ff [videogames] Fix missing covers 2024-04-21 22:36:21 -04:00
dc3a77f14f [scrobbles] Fix typo in timezone saving 2024-04-21 13:29:36 -04:00
5994dccf23 [scrobbles] Clean up location provider log 2024-04-19 15:34:19 -04:00
bfadc0d87b [scrobbles] Just kidding, dt cannot be seriazlied 2024-04-19 15:28:20 -04:00
78782cc538 [scrobbles] Fix geoloc scrobble notes 2024-04-19 15:22:13 -04:00
06277f21de [scrobbles] Clean up inline admin 2024-04-19 15:13:07 -04:00
8fbe37a163 [scrobbles] Remove playback ticks 2024-04-19 15:01:15 -04:00
20dd4d217a [scrobbles] Remove source_id field 2024-04-19 14:57:27 -04:00
53657a9454 [videogames] Add template for video game list 2024-04-19 11:27:27 -04:00
42066cebb2 [scrobbles] Fix display of pages read 2024-04-19 11:27:15 -04:00
6d60a729b7 [scrobbles] Just push old data into JSON 2024-04-19 11:20:30 -04:00
89541a13f2 [webpages] Push to archivebox in a different place 2024-04-19 11:00:07 -04:00
f87bc5fd55 [scrobbles] Unscrewup scrobble migratiosn 2024-04-19 10:48:49 -04:00
0a8078dee0 [scrobbles] Allow skipping the Archivebox push 2024-04-19 10:35:53 -04:00
37da74708c [scrobbles] Fix scrobble having no user in tests 2024-04-19 10:31:33 -04:00
b470e7acea [scrobbles] Fix a migration and how we save timezones 2024-04-19 10:17:38 -04:00
5cdd12783f [scrobbles] Add timezones to scrobbles for better representation 2024-04-19 09:44:15 -04:00
8bf43f298c [books] Fix bug in koreader import using stats, not first_page 2024-04-19 08:45:37 -04:00
a269949a23 [scrobbles] Add webpages to status 2024-04-16 15:17:23 -04:00
8a5f200b44 [scrobbles] Add sports to the status 2024-04-16 15:14:52 -04:00
1c41ca3e18 [locations] Remove redundant field def 2024-04-16 15:09:21 -04:00
b69963b75f [books] Add helper method to get all page data 2024-04-16 15:08:50 -04:00
1327d5da40 [books] Fix index error issue with some imports 2024-04-16 10:47:10 -04:00
5d5b49f19b [webpages] Add bookmarklet support for URLs 2024-04-16 09:54:05 -04:00
d93c827b80 [books] Fix ordering problem with pages 2024-04-16 03:00:20 -04:00
2349c39487 [templates] Fix div mess in status page 2024-04-13 20:33:52 -04:00
ae96831fe4 [scrobbles] Fix status page container 2024-04-13 15:33:38 -04:00
706be782dc [dev] Ignore all sqlite files 2024-04-13 15:26:08 -04:00
a72e0b0fb9 [scrobbles] Add a status page 2024-04-13 15:25:13 -04:00
f5df6c97a9 [scrobbles] Wrap title and sub in span 2024-04-13 01:24:12 -04:00
e00f2de4b1 [videos] Put some views behind login 2024-04-13 01:16:37 -04:00
b4a7cafa3d [profiles] Hide archivebox password 2024-04-13 00:40:00 -04:00
aebe4f899d [webpages] Add pushing webpages to Archivebox 2024-04-13 00:39:18 -04:00
2bf0ca1a8c [books] Fix streaming SQL requets bug 2024-04-10 18:31:39 -04:00
a0c414135c [scrobbles] Fix bug in migrate script and update logging 2024-04-05 12:00:51 -04:00
1dcd151c65 [scrobbles] Migrate scrobble log to JSON field 2024-04-05 11:56:09 -04:00
2e9d92d9c7 [scrobbles] Add json log migration script 2024-04-05 11:38:52 -04:00
8776f75d12 [podcasts] Skip failing tests, bye Google Podcasts 2024-04-05 11:09:10 -04:00
c2a53875a0 [webpages] Clean up how we fetch webpage data 2024-04-05 10:39:30 -04:00
ffb0b7372d [vrobbler] Poetry update 2024-04-02 00:09:44 -04:00
d03744c240 [webpages] Add title cleaner and better url fetching 2024-04-02 00:09:26 -04:00
d9a7929cb0 [webpages] Update lock file for htmldate 2024-03-26 22:51:33 -04:00
9bc087d824 [webpages] Add annotation JS 2024-03-26 22:44:47 -04:00
e65ab4d8c2 [webpages] Break domains out to model 2024-03-26 22:33:56 -04:00
2d26a7c3bd [books] Add comicvine 2024-03-26 22:02:15 -04:00
1fd3e47656 [webpages] Clean up webpage view and add date 2024-03-26 22:01:57 -04:00
dd0ce967c8 [scrobbles] Fix bad update fields call 2024-03-25 16:45:50 -04:00
1f6a4956d2 [videos] Also fix it in series 2024-03-25 15:52:09 -04:00
22f5d288d4 [videos] Fix typo in imdb static path 2024-03-25 15:43:07 -04:00
77cf67ea09 [videoss] Finally add IMDB logo 2024-03-25 15:02:29 -04:00
d1dfc5502d [webpages] Properly use user agent header 2024-03-25 09:58:01 -04:00
0d83050956 [books] Adjust KO migration script for DST 2024-03-25 09:57:25 -04:00
134bd3f650 [books] Fix timezones and duplicated scrobbles 2024-03-23 02:11:06 -04:00
261f2eb9ce [books] Fix KoReader import at end of session 2024-03-19 00:19:40 -04:00
8f56bfba50 [videogames] Fix how we look up IGDB games 2024-03-18 14:58:46 -04:00
750fa05b15 [videogames] Order by ID desc from IGDB to get better results 2024-03-18 14:41:00 -04:00
302ddf6650 [videogames] Fix index error with IGDB lookups 2024-03-18 14:26:09 -04:00
49dd148f9f [scrobbling] Fix missing location in create 2024-03-12 23:15:48 -04:00
79d4e79f3e [scrobbling] Fix locations in proximity of named locations 2024-03-12 18:28:59 -04:00
874d9dc7d2 [locations] Dramatically simplify checking for mvement 2024-03-12 17:53:09 -04:00
0cd95036da [scrobbling] Fix creation of new location scrobbles 2024-03-12 17:12:36 -04:00
829c6b9978 [scrobbling] Fix bad call to has moved 2024-03-12 17:08:43 -04:00
df1bfd4177 [locations] Refactor has moved to not use multiple points 2024-03-12 16:57:56 -04:00
0fff2ec388 [scrobbling] Little location scrobble log clean up 2024-03-12 12:53:11 -04:00
8a83c9fdb3 [scrobbling] Don't run locations though can_be_updated 2024-03-12 12:51:18 -04:00
651fc7a745 [scrobbling] End around for locations 2024-03-12 12:41:00 -04:00
c22a306840 [scrobbling] Tryin in vain to clean up location loggin 2024-03-12 12:38:33 -04:00
11e6161502 [locations] Fix misisng return value 2024-03-12 12:25:48 -04:00
3af2ad203c [scrobbling] Still trying to understand movement 2024-03-12 11:58:44 -04:00
7697dd006d [scrobbling] Futher clean up logging for locations 2024-03-12 11:43:15 -04:00
73a6277e29 [scrobbling] Fix confusing location logging around creating locations 2024-03-12 11:36:51 -04:00
79fc407c33 [scrobbles] Fix bug in can be updated method 2024-03-08 16:53:44 -05:00
84ec84c018 [scrobbles] Try fixing mopidy within existing framework 2024-03-08 14:59:37 -05:00
beb9569663 [scrobbles] Try to fix mopidy double scrobbles 2024-03-08 14:52:01 -05:00
efcf01b49f [scrobbles] Revert previous change, silly 2024-03-08 14:33:31 -05:00
01270a9e32 [scrobbles] Try to fix mopidy double scrobble 2024-03-08 14:16:06 -05:00
c9280c2bad [scrobbles] Fix broken tests 2024-03-08 13:56:53 -05:00
416fd807f4 [scrobbles] Clean up logs and refactor can_be_updated 2024-03-08 13:51:23 -05:00
3069e93697 [scrobbles] Clean up logging in scrobblers 2024-03-08 13:24:57 -05:00
e47f4905e8 [scrobbles] Radically simplify stopping ... may need to roll this back 2024-03-08 12:45:45 -05:00
bf59fb213e [scrobbles] Add media type to our new log 2024-03-08 12:23:39 -05:00
589bf533ea [scrobbles] Add new log on update for scrobble data 2024-03-08 12:14:09 -05:00
1fb29304a3 [scrobbles] Try tweaking completion time for tracks 2024-03-06 20:30:00 -05:00
42604b9e23 [scrobbles] More robust fix for video and track overruns 2024-03-06 19:56:47 -05:00
4642063510 [scrobbles] Add check for long playing videos 2024-03-06 19:07:29 -05:00
65944eb911 [scrobbling] Add media type to filter on 2024-03-06 18:44:10 -05:00
4cf2ceb2dd [scrobbling] Add logging to scrobbler webhooks 2024-03-06 18:29:04 -05:00
78151e5070 [scrobbling] Missed cleaning one log 2024-03-06 18:07:00 -05:00
f90fa160d7 [scrobbling] Enrich some more logs 2024-03-06 18:01:52 -05:00
3b7498c419 [scrobbling] Clean up a few more logs 2024-03-06 17:53:20 -05:00
a59997dafb [scrobbles] Mostly cleaning up our logs 2024-03-06 17:46:55 -05:00
4cdb6150dc [locations] Fix proximity stuff 2024-03-06 16:14:46 -05:00
7fa21c27ea [locations] Remove RawGeoLocation model and ScrobbledPage model 2024-02-19 19:22:13 -05:00
b981c090c6 [locations] Change name of model function 2024-02-18 11:42:42 -05:00
605435b9ea [locations] Make finding proximity locations easier 2024-02-18 11:39:37 -05:00
f4d00b4a22 [locations] Fix typo in settings 2024-02-18 01:46:32 -05:00
504620fc89 [locations] I think proximity logic was reversed 2024-02-18 01:39:53 -05:00
df3424c68f [scrobbles] We don't have a user here yet 2024-02-18 01:39:40 -05:00
71b5af7615 [locations] Oops, don't want to update location scrobbles 2024-02-18 01:25:23 -05:00
7035f01441 [locations] Check for close named locations before creating new 2024-02-18 01:18:15 -05:00
525c7c4e2b [books] Clean up fragmented KoReader scrobbling 2024-02-13 14:54:29 -05:00
4e330a6f03 [webpages] Fix lookup key for scrobbles 2024-02-12 23:06:29 -05:00
ff18ad8efc [webpages] Remane foreign key to web_page 2024-02-12 22:58:07 -05:00
15c1317395 [locations] One more time, trying to fix this stuff 2024-02-12 15:12:12 -05:00
6b80d107b0 [locations] Fix scrobbling logic for locations 2024-02-12 13:47:15 -05:00
13124aca6b [locations] Need to spoof user in gps webhook 2024-02-12 12:42:27 -05:00
a685c6ff9c [locations] Fix calculating playback time 2024-02-12 12:36:38 -05:00
02200bb1f7 Forgot to return when updating! 2024-02-12 12:16:30 -05:00
0bbd488f0d [scrobbling] Sometimes we wont have timestamps 2024-02-12 12:11:07 -05:00
2c08336e33 [locations] Don't scrobble all the locations! 2024-02-12 11:59:15 -05:00
a637a59a40 [scrobbling] Fix location function name typo 2024-02-12 11:48:53 -05:00
123f7c53f9 Oops, no scrobble maybe 2024-02-12 11:38:14 -05:00
2c26cc01ba [scrobbling] Fix scrobble overwriting bug and refactor location scrobbling 2024-02-12 11:34:06 -05:00
36bc1c2e95 [locations] Tigten up how we finish locations 2024-02-11 00:38:10 -05:00
5651ccb990 [scrobbles] can be updated needs no params now 2024-02-11 00:25:12 -05:00
cd7b06eaa2 [settings] Fix typo 2024-02-11 00:16:48 -05:00
949416059d [locations] Try to fix geolocs finally 2024-02-11 00:10:50 -05:00
ca434cb08a [locations] Fix geoloc proximity comparison
Also, make it configurable
2024-02-10 18:13:39 -05:00
2661aee915 [locations] Refactor finding locations 2024-02-10 16:58:07 -05:00
74f672a2fd [locations] settings needs to be int cast 2024-02-10 15:37:31 -05:00
449b74ae3f [scrobbles] Maybe this was a good thing? 2024-02-10 15:30:23 -05:00
3d1ad8da3a [locations] Need to be specific to geolocs 2024-02-10 15:29:06 -05:00
75e374bb69 [locations] Do not mark geolocs complete automatically 2024-02-10 15:23:37 -05:00
2ba694655b [locations] Fix constant typo 2024-02-10 15:14:42 -05:00
879942d070 [locations] Geo accuracy should be int 2024-02-10 15:12:31 -05:00
bfd210d280 [locations] Turns out we were looking them up wrong 2024-02-10 15:06:16 -05:00
e5c6b5e8d9 [locations] Fix updating locations one more time 2024-02-10 14:43:46 -05:00
3cd1603b91 [locations] Try new logic on whether we've moved 2024-02-10 14:37:01 -05:00
27523bc7ff [locations] Flip the logic on whether we've moved 2024-02-10 14:30:41 -05:00
67ef1a15ec [podcasts] Fix missning enum type for podcasts 2024-02-10 14:16:13 -05:00
288027bfce [locations] Diff loc using Decimal math 2024-02-10 14:11:38 -05:00
bfdf73d4c0 [podcasts] Fix name for Episode model to PodcastEpisode 2024-02-10 13:57:42 -05:00
033e3c3b35 [locations] Try another tack for whether we've moved or not 2024-02-10 13:18:45 -05:00
40504f83e1 Add reuse-db option to pytest 2024-02-08 23:05:28 -05:00
ccca81bbab Add tests for Location models 2024-02-08 23:05:20 -05:00
84f49af163 Need to rethink this, it may be fine 2024-02-04 02:07:35 -05:00
e044c70072 Fix inversion of next and last for scrobbles 2024-02-04 01:45:54 -05:00
d3e09c25bd Fix bug in looking up book MD5 hash 2024-02-03 00:42:11 -05:00
30f78a9290 Fix bug in koreader migrator and delete scrobbles before migrating 2024-02-03 00:41:47 -05:00
a5553966de Add script for building scrobbles from past pages 2024-01-31 01:19:58 -05:00
9e2d7a6bc0 Start to add comicvine lookups and consoldiate koreader data 2024-01-29 01:48:56 -05:00
70c7eda415 [books] Don't auto update metadata on save 2024-01-27 01:16:45 -05:00
0ad7dac6cb Fix bug in end_ts calc for book scrobbles 2024-01-27 01:16:45 -05:00
209875f0e6 Import fix, and don't overwrite KoReader data when OL conflicts 2024-01-27 01:16:45 -05:00
919fa1b0b4 Add fuzzing for book titles 2024-01-27 01:16:45 -05:00
0b3bc53704 Fix openlibrary lookups 2024-01-27 01:16:45 -05:00
dfc1365fa3 Fix koreader importing 2024-01-27 01:16:45 -05:00
f22ef1a163 Set user profile TZ to UTC by default, and setup signal 2024-01-27 01:16:45 -05:00
7cb818b585 Fix issue where pages may not come back from OL 2024-01-27 01:16:45 -05:00
1a5cd5106f Update drone file with dev requirements 2024-01-25 10:30:42 -05:00
3b65144b68 Fine tuning koreader imports on real files 2024-01-25 10:15:15 -05:00
4ae13b3a1a Refactor new KoReader importer a bit 2024-01-25 02:08:03 -05:00
3de2be50cf Start refactoring the koreader importer 2024-01-22 20:26:11 -05:00
80d197bc54 Add new field to scrobbles for page data 2024-01-22 19:40:39 -05:00
a274796405 Fix bug in GeoLocation setting 2024-01-22 00:52:01 -05:00
37fd1d8458 Fix old style poetry groups 2024-01-22 00:50:30 -05:00
45ddce36aa Look in DB for book first 2024-01-21 00:31:07 -05:00
c3ddd01a6f Default to getting a boardgame in the DB 2024-01-21 00:27:31 -05:00
6920c99931 Don't relookup games if we have it already 2024-01-18 17:20:20 -05:00
d2d71b3c85 Fix typo in view for resuming scrobbles 2024-01-18 17:06:00 -05:00
6300df8e9e Update accuracy of geolocations 2024-01-02 19:09:42 -05:00
b427731bc3 Use raw IDs for scrobbler media 2023-12-28 23:18:01 -05:00
6058024434 Fix date parsing for real in podcasts 2023-12-23 16:07:38 -05:00
a4d9bd607c Remove whitespace on podcast names and episode titles 2023-12-23 15:49:45 -05:00
9349009ffa Try sorting IGDB results by ID 2023-12-23 15:36:17 -05:00
2293c839e8 Make podcast str parsing sensitive to episode number length 2023-12-23 15:25:48 -05:00
34fb2df782 Turns out we don't need the click thing 2023-12-21 13:22:03 -05:00
3b2158d85c Merge branch 'develop' of secstate/vrobbler into main 2023-12-21 13:19:12 -05:00
7daef6677d Add click to notification 2023-12-21 13:16:22 -05:00
d895cf9110 Fix bad drone file 2023-12-21 12:37:10 -05:00
dffb4f087c Try fixing drone 2023-12-21 12:36:38 -05:00
37c1aab749 Fix timeout on deploy 2023-12-21 12:31:21 -05:00
9083e744da Actually use the drone plugin 2023-12-21 12:18:59 -05:00
af1b6cb4ed Fix parsing podcast URLs 2023-12-21 12:14:33 -05:00
de8727ee05 Also hup immortal, cause sometimes it's a pain 2023-12-21 11:44:14 -05:00
fd645420b8 Escape colons in yaml files 2023-12-21 11:10:44 -05:00
1fdad9ce5b Add curl command to deploy setp 2023-12-21 11:00:57 -05:00
81551ecb41 Add ntfy to deploy pipeline 2023-12-21 11:00:05 -05:00
7a5b4c1b08 Update drone with ntfy curl 2023-12-21 10:59:02 -05:00
c144f07f78 Fix parsing of podcast URIs 2023-12-21 10:52:51 -05:00
b44af1f79d Fix geolocation centers 2023-12-15 21:18:18 -05:00
22f3b94448 Add webpage pages and redirect 2023-12-12 00:35:01 +01:00
36adf5a904 Add detail page for webpages 2023-12-12 00:35:01 +01:00
c2f43861fd Fix scrobble counts on webpage list view 2023-12-12 00:35:01 +01:00
356579f78a Fix bug with stopping wrong scrobble 2023-12-09 23:14:50 +01:00
e5ed265e8f Fix None title bug 2023-12-09 22:34:49 +01:00
97d5478792 Better logging 2023-12-09 22:22:56 +01:00
96ca2f5602 Stop location scrobbles properly 2023-12-09 21:32:13 +01:00
478780e9b3 Better instrumentation 2023-12-08 15:52:43 +01:00
9aaed4f332 Fix looking up past locations 2023-12-08 15:36:31 +01:00
4327ff499c Check for similar title location if we've gotten that far 2023-12-08 15:02:48 +01:00
b53017d226 Update cover images too 2023-12-05 16:56:21 +01:00
4e694bd1b3 Fix top chart view 2023-12-05 16:39:34 +01:00
7a9f4a0876 Get the old homepage back! 2023-12-05 16:10:27 +01:00
431976296f Fix typo 2023-12-03 00:48:02 +01:00
1e84497c85 Actually save run time seconds 2023-12-01 14:00:24 +01:00
05458b1fb9 Add subtitle and update play time for webpages 2023-12-01 01:00:58 +01:00
93a514fc37 Down size long play images 2023-12-01 00:47:26 +01:00
c4c810e23f Catch if video game cover is missing 2023-12-01 00:42:53 +01:00
d1de4103e1 Fix early access of url that may not exist 2023-12-01 00:20:55 +01:00
d0b298e4cc Fix resizing function for music 2023-12-01 00:19:53 +01:00
91ed364747 Return 200 if resource already exists (no scrobble created) 2023-12-01 00:17:10 +01:00
e6f78f4b1d Add downsampling for screenshots 2023-12-01 00:08:22 +01:00
f452ed748e Fix video cover image dealy 2023-11-30 23:56:08 +01:00
63ddb51e89 Add even more imagekit gloriousness 2023-11-30 23:37:42 +01:00
61c10db0dd Try adding imagekit just once 2023-11-30 22:52:38 +01:00
6696d38638 Fix bad import of scrobbler methods 2023-11-30 21:37:01 +01:00
84351f8bcc Add time to read calc 2023-11-30 18:38:46 +01:00
eb1a22e69f Add webpage urls 2023-11-30 18:21:16 +01:00
34ecb71c44 Add text extraction to webpages 2023-11-30 18:19:30 +01:00
33dfbc2c2e Add default readtime to webpages, and fix reverse 2023-11-30 18:09:25 +01:00
8eb2526404 Fix no webpage media obj 2023-11-30 18:01:12 +01:00
8e99918813 Add webpage scrobbling modifier 2023-11-30 17:56:45 +01:00
ea894e1ebf Fix scrobble admin and add webpage views 2023-11-30 17:54:28 +01:00
edcfbd829a Fix import in views 2023-11-30 17:50:53 +01:00
4e1db4aa6f Add webpage scrobbling 2023-11-30 17:49:53 +01:00
f303115ca0 Ooops, use bggeek ID 2023-11-27 20:56:56 +01:00
5928a07ef0 Fix missing import 2023-11-27 20:53:26 +01:00
dea34c926b Allow playing board games again 2023-11-27 20:46:48 +01:00
7564292f5b Order locations by scrobble timestmap 2023-11-27 18:49:24 +01:00
5aa155094f Fix bug where geo locs were not getitng scrobbled 2023-11-27 18:25:42 +01:00
635e8053cd Fix bug in notes for geo scrobbles 2023-11-26 21:36:45 +01:00
0d3da63aaf Fix bug in geo scrobbler 2023-11-26 21:32:26 +01:00
1670a7cd7a Try to ignore duplicate geo scrobbles 2023-11-26 21:20:49 +01:00
0505d01b71 Use timestamp to get latest scrobble for media type 2023-11-26 20:53:31 +01:00
aae2dd7567 Exclude geo locs from now playing 2023-11-26 11:12:48 +01:00
88c252eb45 Fix wrong ordering for long plays on completion 2023-11-26 11:09:09 +01:00
abd07f3113 Clean up location templates 2023-11-25 15:56:05 +01:00
9ba9319885 Add scrobble to locations list 2023-11-25 15:39:27 +01:00
22ad340d43 Filter locations by user 2023-11-25 15:36:33 +01:00
b0574ecf80 Update admin for geolocations 2023-11-25 00:38:08 +01:00
e9db212121 Fix dupped lat code 2023-11-25 00:36:07 +01:00
d5d0325420 And again 2023-11-25 00:31:44 +01:00
1bc5cf31e0 That's why we should have tests 2023-11-25 00:27:12 +01:00
2e2d491e2e Truncate better 2023-11-25 00:22:34 +01:00
c7d1272e99 Remove funky truncation end around 2023-11-24 19:51:37 +01:00
7a6bd169bf Add truncated lat lon to model 2023-11-24 19:17:43 +01:00
bbaa8fa078 Fix issue with GPS scrobbles being always in progress 2023-11-24 15:52:36 +01:00
21995c62fb No need to save raw anymore 2023-11-24 15:41:34 +01:00
880f810aa1 Fix scrobbling of locations 2023-11-24 15:41:10 +01:00
49e4e9b69a Remove custom repo for pypi 2023-11-24 15:18:11 +01:00
b50778b43f Add locations to test settings 2023-11-24 15:15:20 +01:00
da944f9ef1 Try and fix things 2023-11-24 14:33:09 +01:00
f6509bbaa8 Update migration path 2023-11-24 13:45:40 +01:00
f9aab6296b Gah, maybe still truncate a little 2023-11-24 02:06:26 +01:00
899129dfd9 Don't dumb down geolocations 2023-11-24 02:04:24 +01:00
3eb51a871e Fix migrations and add location tab 2023-11-24 01:55:53 +01:00
ca3e495467 Clean up location detail 2023-11-24 01:35:32 +01:00
85a91b340a Add location templates 2023-11-24 01:33:33 +01:00
e04be4fbdd Fix Last.FM imports coming in as videos 2023-11-24 00:26:35 +01:00
f9a98e9de9 Truncate altitude to two places 2023-11-24 00:26:02 +01:00
f18d81296b Use constant for location providers 2023-11-23 23:27:16 +01:00
e86d8cc9fe Fix silly bug in sportsdb settings 2023-11-23 23:26:03 +01:00
4ab796fe12 Add pendulum 2023-11-23 09:39:03 +01:00
fc64dfadba Add basic location tracking 2023-11-23 00:58:11 +01:00
a5d729d26a Add stub for future board game resume function 2023-09-14 00:43:05 -04:00
a661135394 Slim down the homepage 2023-09-14 00:23:12 -04:00
f1b1989424 Add book lookup via locg 2023-08-31 01:27:37 -04:00
145212fe46 Fix first sentence length 2023-08-18 22:48:02 -04:00
607c2522f3 Add ipython 2023-08-15 14:57:30 -04:00
8646fd6881 Add ScrobbledPage model to start book transition 2023-07-25 15:22:23 -04:00
63b783229c Simplify scrapper test 2023-07-25 14:59:54 -04:00
b7e15da87a Add genres to books 2023-07-25 14:55:50 -04:00
8a597ef1b0 Reorganize tadb lookup to actually work 2023-06-21 14:36:01 -04:00
ca65ce11f2 Still need to bail on bad responses 2023-06-21 11:35:43 -04:00
ad2f28c214 Allow forcing updates from TADB 2023-06-21 11:18:06 -04:00
e517327ce3 Clean up video detail pages 2023-06-15 17:20:03 -04:00
ff5a88cb17 Add screenshots and saves to VG details 2023-06-15 11:20:10 -04:00
1fedf77b87 Fix error getting process log lines 2023-06-15 11:13:53 -04:00
837aa53c9b Add duration to video game and board game lists 2023-06-15 11:13:38 -04:00
9e38798f44 Add board and video games to index 2023-06-06 11:59:51 -04:00
6d841167ea Clean up tick logic 2023-06-05 22:21:15 -04:00
6e97298949 Fix timestamp updated with every tick 2023-06-05 22:20:14 -04:00
40fc4d21d3 Try ignoring jellyfin video progress 2023-06-05 14:12:49 -04:00
9eeb708a51 Trying again with Jellyfin 2023-06-05 10:57:03 -04:00
35214de127 Fix jellyfin overwriting scrobbles 2023-06-05 10:20:08 -04:00
0adc97f440 Add video game screenshots to scrobbles 2023-06-03 14:19:06 -04:00
0140126ed8 Condense aggergator tests 2023-06-01 19:57:39 -04:00
f7b8bc3bfc Remove reuse-db flag 2023-06-01 19:51:40 -04:00
7e16388f81 Add tests for BGG 2023-06-01 19:47:32 -04:00
6dc09e723d Fix tests 2023-06-01 19:28:33 -04:00
1d50c32ba9 Set timezone properly for vg scrobbles 2023-06-01 16:18:25 -04:00
0bf4d28482 Actually fix the TSV timezone issue 2023-05-31 23:08:03 -04:00
bcf2b9d1ea I don't think TSV files are in UTC after all 2023-05-31 22:27:09 -04:00
a3bf9b0081 Fix title of retroarch import page 2023-05-31 20:19:09 -04:00
1e35f10945 Add retroarch imports to list view 2023-05-31 20:18:29 -04:00
955b6f028a Clean up retroarch scrobbling 2023-05-29 23:05:58 -04:00
cc751d0953 Duplicate long play complete from last scrobble 2023-05-28 10:25:34 -04:00
a7e8e4f1dc Fix importing from AGB 2023-05-28 10:11:24 -04:00
f55aed7b3d Fix case where cover url is missing 2023-05-27 23:11:50 -04:00
79265feb39 Need to actually used a timezone instance 2023-05-27 23:09:54 -04:00
1ba5b4cf4b Fix retroarch defaulting to utc 2023-05-27 23:01:29 -04:00
39add993e0 Fix looking up games by hltb only 2023-05-27 22:21:20 -04:00
4fd8a5b9a5 Catch json decoding errors 2023-05-27 00:19:50 -04:00
dad936cd6b Fix tests 2023-05-26 23:12:55 -04:00
704409cf6e Fix retroarch times not in UTC 2023-05-26 23:12:43 -04:00
6ee57cb7cd Fix minor issues with retroarch scrobbling 2023-05-26 22:55:09 -04:00
95da4c063e Fix scraping of MAME games 2023-05-25 01:06:20 -04:00
93de6d1556 Add retroarch import tasks and models 2023-05-24 22:38:20 -04:00
dbbb2b43a8 Add scrobble list to import detail view 2023-05-24 19:31:16 -04:00
7758c56d10 Bump python drone version 2023-05-24 17:16:42 -04:00
6c56cfab85 Initial retroarch import code 2023-05-24 17:12:28 -04:00
6753c3717f Fix book lookup if OL ID exists 2023-05-23 16:33:22 -04:00
085c666c19 AudioScrobbler imports only tracks, set media type 2023-05-22 11:36:47 -04:00
dca66003fd Limit imports to last 10 2023-05-04 09:56:05 -04:00
dc55c538ab Try release group ID 2023-04-30 10:25:19 -04:00
bb69be4817 Rather change names than fuck up MB IDs 2023-04-30 10:25:19 -04:00
af0223ab4c Put import records in rows 2023-04-26 19:35:56 -04:00
9ed5d5dc1a Add columsn to list import 2023-04-26 14:03:14 -04:00
dedf28c6de Update import listings 2023-04-26 12:01:50 -04:00
3607d4d4a4 Fix build badge 2023-04-22 20:54:29 -04:00
6bdb7b6e1f Fix scrobbling movies 2023-04-22 20:38:03 -04:00
c864f408a1 Ooops. Set artist image on actual model 2023-04-19 00:25:25 -04:00
f1c22bfbc0 Disable lastfm import button if auto imports on 2023-04-19 00:20:45 -04:00
88bd049d95 Set media type on KOReader import to book 2023-04-19 00:20:45 -04:00
8f4ce4441b Default to album art if artist not found 2023-04-18 13:29:43 -04:00
bee9ac8d25 Clean up board game scrobbling 2023-04-18 11:37:47 -04:00
61c9e362a8 Save playback position on manual scrobbles 2023-04-18 11:15:56 -04:00
efde57078e Add scrobbling of board games 2023-04-18 11:15:02 -04:00
fc927c72d1 Add board game urls and views 2023-04-18 11:04:02 -04:00
5c3a554010 Make genre optional 2023-04-17 22:33:36 -04:00
f21650505c Add board game media type 2023-04-17 18:46:32 -04:00
0217c96faf Add boardgames as scrobblable 2023-04-17 18:29:39 -04:00
4654902adc Simplify, simplify, simplify
The way we calculate past seconds for long plays should be much less
error prone and uses our built-in previous scrobble accessor for media types.
2023-04-15 13:12:21 -04:00
954b35b1d0 Set stop_timestamp when stopping scrobbles 2023-04-15 13:02:07 -04:00
620f52f9ef Fix manual scrobble of long plays 2023-04-15 09:43:53 -04:00
e495a08d1f Clean up sports lookuops a little 2023-04-15 09:13:32 -04:00
74ce5ec9ab Fix force finishing scrobbles not marked completed 2023-04-15 09:13:12 -04:00
fb107c083f Greatly simplify scrobbling books 2023-04-15 09:03:06 -04:00
f9dcc0d341 Fix a handful of little bugs
Refactor of manual scrobbling missed an import
KoReader book removed in sqlite fails import
Looking up album by name and artists screws up on MBid unique
2023-04-13 10:20:21 -04:00
9eef5d721b Image changed on tests 2023-04-11 22:48:50 -04:00
6d613028fc Fix looking up book using ISBN 2023-04-11 22:47:10 -04:00
7db98f0979 Clean up code for manaul scrobblign 2023-04-11 18:08:43 -04:00
4e38605008 Fix wrong model type for podcast media type 2023-04-09 01:11:25 -04:00
7106a0840d Add media type to scrobbles 2023-04-09 01:05:09 -04:00
1f7846f096 Add media type to scrobble admin filter 2023-04-08 23:02:26 -04:00
010565efb7 Update todos 2023-04-07 12:07:10 -04:00
9baf1069b6 Fix it so lastfm imports dont barf 2023-04-06 15:39:13 -04:00
2896225826 Fix bad lookup of artists 2023-04-06 14:09:00 -04:00
be6b3c5e2e Add ability to restart lastfm imports 2023-04-06 14:00:48 -04:00
e487f50683 Add a command to remove zombie scrobbles 2023-04-06 13:53:22 -04:00
8042c726b0 Allow profile disable of lastfm imports 2023-04-06 13:37:10 -04:00
59e29d858a Add command for running lastfm imports 2023-04-06 13:36:02 -04:00
a59bcf054a Bump version to 0.13.2 2023-04-02 23:58:16 -04:00
fe4faee7aa Add an end timestamp 2023-04-02 23:57:55 -04:00
5db8bf0329 Move check for finish up a level 2023-04-02 23:44:07 -04:00
d085bf2153 Don't bother with authors in book metadata 2023-04-02 23:21:34 -04:00
a133e7a30c Someone fixed an NPR typo 2023-04-02 23:01:00 -04:00
ca59605afc Dont bail on stop if not in progress 2023-04-02 22:46:58 -04:00
597ac2c7b8 Add save game data for video game scrobbles 2023-04-02 22:43:58 -04:00
f04f8b04c0 Ooops, need to pop after updating 2023-04-02 22:37:56 -04:00
2215976571 Fix jellyfin duping scrobbles after complete 2023-04-02 18:48:55 -04:00
e6bb52702c Fix migration with timezone issue 2023-03-30 02:00:14 -04:00
0dc0102bb6 Refactor long play finishing 2023-03-30 01:55:36 -04:00
7d1e070ee6 Fix scrobbles same song over and over error 2023-03-30 01:48:20 -04:00
6c060f24ec Default timezone to one that respects DST 2023-03-30 00:34:17 -04:00
b6a0f0d3fb Fix koreader importing 2023-03-30 00:34:09 -04:00
1c6f28bae3 Fix bad lookup of covers in long play template 2023-03-29 15:40:44 -04:00
845ee7d4e9 Revert "First run at adding thumbnailing to images"
This reverts commit c00343abfe.
2023-03-28 15:33:53 -04:00
dadc5db0f9 Revert "Fix bug in thumbnail tag"
This reverts commit c39430e987.
2023-03-28 15:33:47 -04:00
c4ddb4b51c Revert "Let's also thumbnail the now playing widget"
This reverts commit 76cc1f7b1c.
2023-03-28 15:33:37 -04:00
76cc1f7b1c Let's also thumbnail the now playing widget 2023-03-28 15:24:04 -04:00
c39430e987 Fix bug in thumbnail tag 2023-03-28 14:45:23 -04:00
c00343abfe First run at adding thumbnailing to images 2023-03-28 14:22:38 -04:00
84070d2806 Fix wrong page table name for KOReader 2023-03-28 01:29:59 -04:00
4a929956a7 Fix bug in importing TSV files 2023-03-28 00:04:08 -04:00
a7bf405af2 Bit of a hack to fix artist lookups 2023-03-27 23:49:00 -04:00
09f97c6eed Move bug fixing to lower priority 2023-03-27 23:45:54 -04:00
1ee8fc589a Actually fix the VA bug 2023-03-27 20:19:03 -04:00
3e2a9d2183 Fix koreader book ID bug 2023-03-27 01:38:04 -04:00
cb0c00a695 Strip initials from koreader authors 2023-03-27 01:35:22 -04:00
ee01ffa4ad Fix scrobbing pages 2023-03-27 01:31:05 -04:00
d19838a26f Add proper author lookups and fix bad OL fixes 2023-03-27 01:10:28 -04:00
c571043788 Fix aggregator being blank on Sundays and BS4 warnings 2023-03-26 13:52:17 -04:00
f082bea571 Fix KOReader imports to use pages for scrobbles 2023-03-26 12:43:54 -04:00
bcd35842cd Add new fields to page to use it better 2023-03-26 12:30:06 -04:00
5c9a877a9a Add stream sqlite for S3 file parsing 2023-03-26 12:27:12 -04:00
9a2ba1fd07 Fix importing TSV files with S3 2023-03-25 11:10:33 -04:00
f3e90e4ad4 Clean up some settings in S3 uploads 2023-03-24 18:21:38 -04:00
a7605d9cc5 Fix small bug in getting album cover images 2023-03-24 15:18:59 -04:00
2c946c1071 Need custom storage to have two different paths 2023-03-24 15:17:55 -04:00
1e17a679d3 Allow S3 usage 2023-03-24 14:47:37 -04:00
e6914ed079 Fix vrobbler boolean settings bug 2023-03-24 10:47:12 -04:00
bf2d1f0c0a Update todos 2023-03-24 10:45:45 -04:00
951554b6fc Fix charts to do rolling day counts 2023-03-24 00:58:27 -04:00
662578e941 Update deps and use a local caching repo for poetry 2023-03-23 15:45:39 -04:00
524e6b0027 Only deploy from main branch 2023-03-23 10:28:33 -04:00
ede4767a39 Need to use a tag, not div 2023-03-23 00:26:54 -04:00
d2d81f7119 Dont reset immortaldir on deploy 2023-03-23 00:16:27 -04:00
1d95d59d8d Add podcast pages 2023-03-23 00:16:20 -04:00
70118e2e62 Add podcast field for google url 2023-03-23 00:06:14 -04:00
04a48af4c9 Fix scraper tests for podcasts 2023-03-22 23:56:02 -04:00
59d652a9c4 Fix bug in adding producers 2023-03-22 23:49:40 -04:00
945776b885 Oops, url is loaded via JS :( 2023-03-22 23:47:57 -04:00
98f9c4bc04 Add url to scraped data for podcasts 2023-03-22 23:38:48 -04:00
36eda9f258 Fix primary image for podcast episodes 2023-03-22 23:31:09 -04:00
efd3acbc70 Fix saving producers 2023-03-22 23:30:26 -04:00
1ac0fc5b23 Oops, let drone run longer than 2 minutes 2023-03-22 23:29:33 -04:00
fd23928922 Fix bug in scraping podcasts 2023-03-22 23:22:23 -04:00
2d50964971 Couple tweeks to drone deploys 2023-03-22 23:20:32 -04:00
8b21861867 Add proper deploy step to CI 2023-03-22 23:13:20 -04:00
a0d67cbcd2 Test deploy keys 2023-03-22 23:03:45 -04:00
9f60411c5e Add scaper to podcast model 2023-03-22 22:57:18 -04:00
dd66774bda Add podcast scraper using Google 2023-03-22 22:50:44 -04:00
15be4e0068 Add generalized cover field for scobblable things 2023-03-22 18:44:06 -04:00
bc59ff66eb Update todos 2023-03-22 17:13:35 -04:00
b5d6bea0d1 Fix bug in looking up albums by artists 2023-03-20 16:35:01 -04:00
bbf3819e08 Fix TSV imports of incomplete files 2023-03-17 10:27:02 -04:00
1b56933969 Fix missing isbn error 2023-03-16 17:40:15 -04:00
f8628f7826 Fix adding up of total play back time 2023-03-16 17:37:37 -04:00
20b11359e0 Add index to rank field 2023-03-15 17:55:23 -04:00
ecc26138a7 Add source id message for manuals 2023-03-15 14:43:47 -04:00
5ce48277ed Add default series source 2023-03-15 14:42:05 -04:00
447a4e830e Allow starting next in series 2023-03-15 14:38:59 -04:00
e8f1bcbe31 Little tweaks to album art 2023-03-15 13:11:21 -04:00
131fc379c3 Keep fixing primary artists issues 2023-03-15 12:51:33 -04:00
dd34e34970 Replace primary artist in allmusic 2023-03-15 12:48:26 -04:00
23f1cb749e One more try 2023-03-15 12:47:42 -04:00
95507f640e Fix creating new tracks 2023-03-15 12:40:34 -04:00
db32777f28 Add album_artist idea 2023-03-15 12:34:42 -04:00
a2135b5d55 Okay, we want to lookup albums by name and artist 2023-03-15 01:29:48 -04:00
87fcfbb7d9 Fix duplicate albums created via TSV imports 2023-03-15 01:24:25 -04:00
92b4caa32f Fix TSV imports with new run time seconds 2023-03-15 00:13:50 -04:00
31f490a32b Scrape all the things 2023-03-14 23:40:54 -04:00
5b5b67d42a Add genre fetching from IGDB 2023-03-14 18:44:28 -04:00
c9874b3fda Add genres! 2023-03-14 18:36:44 -04:00
c9b04772a0 Fix video game scraping when igdb id is there 2023-03-14 18:20:10 -04:00
f9420c7a41 Cleaning up video and series pages 2023-03-14 18:19:14 -04:00
fbe35a02a1 Fix display of sports 2023-03-14 17:22:57 -04:00
8122179c7a Clean up rounds in sports 2023-03-14 17:00:47 -04:00
f7a757c485 Add new field for run time to sports 2023-03-14 16:45:36 -04:00
62850dd4f1 Fix bug in run time for sports 2023-03-14 16:43:54 -04:00
7d7ec4b676 Get title from MB album lookup 2023-03-14 12:57:20 -04:00
6dee409a55 Fix imports from LastFM without albums 2023-03-14 12:32:48 -04:00
1242740258 Reverse! 2023-03-13 18:51:21 -04:00
6fb6093fe1 Few quick fixes 2023-03-13 18:48:06 -04:00
5fcc314fd0 Split long plays up a bit 2023-03-13 18:46:26 -04:00
856546b633 Fix space in icons 2023-03-13 18:22:44 -04:00
b96683b3ad Add metadata fixing to video games 2023-03-13 18:20:23 -04:00
aab403a782 Avoid recussion limit on saving video games 2023-03-13 18:19:30 -04:00
8e3a2d251a Order long plays 2023-03-13 17:38:08 -04:00
e386d160e2 Fix bad video game templates 2023-03-13 15:49:20 -04:00
4867acb30b Fix display of covers 2023-03-13 14:54:11 -04:00
d071319df4 Add video and series detail pages 2023-03-13 14:43:08 -04:00
c494779c82 Fix errant tick code 2023-03-13 03:23:12 -04:00
52fc67803a Clean up how we scrobble videos 2023-03-13 03:22:44 -04:00
f504d9f2a1 Fix none from KoReader imports 2023-03-12 17:13:56 -04:00
34a6ac192d Fix progress for books with no scrobbles 2023-03-12 16:15:20 -04:00
69bdc60087 Fix scrobbling videos 2023-03-12 14:06:39 -04:00
9ac5ef8f59 Fix metadata scrapper for books 2023-03-12 13:31:28 -04:00
95b625cec2 Fix redundant tick field 2023-03-12 10:54:09 -04:00
f6c1a459d4 Add resume URLs to list views 2023-03-11 19:59:15 -05:00
e5acedbb01 More url cleanup 2023-03-11 19:59:07 -05:00
b01ceebbf3 No need for scrobble logs 2023-03-11 19:58:54 -05:00
43dc625e4a Clean up scrobble urls 2023-03-11 19:58:43 -05:00
38f40e014a Add notes to scrobble model 2023-03-11 19:58:34 -05:00
bb2a80e2aa Add ability to manage long plays 2023-03-11 14:11:31 -05:00
6e03cf5075 Fix author imports for books 2023-03-11 12:57:23 -05:00
fadc281fe8 Fix bad import on books 2023-03-11 11:58:55 -05:00
d79159670e Add chart view when not auth'd 2023-03-10 11:30:23 -05:00
489d8b9152 Fix lookup of long play media types 2023-03-10 09:32:57 -05:00
638a5d05bd Fix updating long play seconds 2023-03-09 21:55:36 -05:00
6c880b3030 Fix calculating pages read 2023-03-08 13:44:05 -05:00
76b1816452 Incorrect way to get long play 2023-03-08 13:30:36 -05:00
323e9ec8bf Fix display of progress in long play 2023-03-08 13:30:05 -05:00
6ffc77a9d5 Move grid buttons to base list 2023-03-08 13:16:21 -05:00
e42ee0e03a Fix padding on long play media 2023-03-08 12:56:22 -05:00
bb9259a82a Fix splitting scrobble key 2023-03-08 12:51:59 -05:00
6b02930a1a Update todos! 2023-03-08 12:47:36 -05:00
aefdc507d8 Fix comma if only hours 2023-03-08 12:47:29 -05:00
b307054453 Update long play templates, remove chart 2023-03-08 12:45:30 -05:00
960fe3e8d1 Add long play infra 2023-03-08 12:11:58 -05:00
788e1ab9e9 Fix book importing 2023-03-06 14:05:33 -05:00
73c72ef465 Update long play to use seconds 2023-03-06 10:21:27 -05:00
551e6f4f7e Allow forcing book updats 2023-03-06 01:17:32 -05:00
a5f24cd5ec Fix minor issue in saving book scrobbles 2023-03-06 01:06:02 -05:00
4d5e979a1a Fix bug in finishing scrobbles 2023-03-06 01:03:40 -05:00
3fc716420c Add basic views for books and games 2023-03-06 00:54:08 -05:00
9bcd9d8bb7 Fixing long play scrobbles 2023-03-06 00:53:50 -05:00
a4537879f9 Allow scrobbling video games 2023-03-05 18:05:10 -05:00
df62865eea Fix completion for video games 2023-03-05 17:27:39 -05:00
c757e743ac Boom. Video game metadata 2023-03-05 16:36:36 -05:00
a0e852775c Add video games to scrobbles 2023-03-05 02:31:13 -05:00
353fb8d655 Few tweaks to utils 2023-03-05 02:31:00 -05:00
d8edad98b2 Hide sensitive data in admin 2023-03-05 02:30:42 -05:00
9848d311c4 Update music admin with search 2023-03-05 02:30:23 -05:00
22c33d24c3 Move utils to openlibrary module 2023-03-05 02:30:12 -05:00
0a6774c284 Reorganize books 2023-03-05 02:30:01 -05:00
25c00d7f1b First pass at adding videogames 2023-03-05 02:29:20 -05:00
7d7123498b Skip crappy tests 2023-03-04 17:58:48 -05:00
d0bb07df29 Fix flake8 issues 2023-03-04 17:33:41 -05:00
94f1396f2e Blacken quotes 2023-03-04 17:29:25 -05:00
3d7528030a Clean up imports 2023-03-04 17:28:42 -05:00
9c881d3bd9 If no artist, no image 2023-03-04 17:27:48 -05:00
5c135b2d2e Change placeholder photo 2023-03-04 17:19:28 -05:00
4c945932f9 Update not found image 2023-03-04 17:08:21 -05:00
90b7be286c Move lookup modules to approp app 2023-03-04 16:04:52 -05:00
00aa2e892f Fix bug in artist and album lookup 2023-03-04 15:46:34 -05:00
2811146656 Add icons for music services 2023-03-04 15:46:26 -05:00
34a2339b3b Bump version to 0.11.12 2023-03-03 21:56:32 -05:00
34abbe753b Fix a few display issues with charts 2023-03-03 21:55:36 -05:00
0fe00c3dd8 Fix bug in album creation 2023-03-03 21:55:26 -05:00
5a3eb7a8c8 Bump version to 0.11.11 2023-03-03 16:14:11 -05:00
e63ca13d57 Small tweaks to scorbble view 2023-03-03 16:13:06 -05:00
b3d3098fe0 Fix importing albums 2023-03-03 16:12:38 -05:00
8f5a200526 Bump version to 0.11.10 2023-03-03 12:12:19 -05:00
411d2b42b0 Add better titles to artists too 2023-03-03 11:44:36 -05:00
bce1322289 Fix images and default to Maloja 2023-03-03 11:42:56 -05:00
908819d24e Damn capital letter 2023-03-03 11:02:22 -05:00
6d21bb2e85 Bump version to 0.11.9 2023-03-03 02:41:47 -05:00
7df3fedc64 Fix bad image templates 2023-03-03 02:41:27 -05:00
b4e83b184e Bump version to 0.11.8 2023-03-03 02:32:55 -05:00
6e885df1dd Small fix to remove unused templatetag 2023-03-03 02:32:32 -05:00
f153f831b3 Bump version to 0.11.7 2023-03-03 02:29:56 -05:00
66a90c87f1 Add demo of maloja style 2023-03-03 02:29:32 -05:00
6e17e4ce0d Fix chart rank and periods 2023-03-03 02:29:15 -05:00
3c3e567573 Bump version to 0.11.6 2023-03-02 16:11:48 -05:00
2775851474 Clean up the video detail page 2023-03-02 16:11:19 -05:00
654a64e82d Stub in sports urls 2023-03-02 16:04:44 -05:00
7dd7f369d8 Fix bug in audiodb scrape path 2023-03-02 15:45:15 -05:00
fb6110c71d Bump version to 0.11.5
Version 1.0 approaches!
2023-03-02 15:11:40 -05:00
93299a1abd Hide album urls that don't exist 2023-03-02 15:08:34 -05:00
a58ddebd23 Fix typo in audiodb lookup 2023-03-02 15:08:22 -05:00
41cdb96e94 Clean up album admin with new data 2023-03-02 15:08:11 -05:00
5a8e828b81 Add rudimentary album metadata from TADB 2023-03-02 14:48:33 -05:00
c84a3072be Dont show None if bio is missing 2023-03-02 11:26:31 -05:00
0bd7ed4463 Clean up music detail views 2023-03-02 11:03:26 -05:00
ee232aa103 Fix Le Static Files 2023-03-01 19:11:16 -05:00
7151646600 Bump version to 0.11.4 2023-03-01 00:15:29 -05:00
1d7cf965ef Clean up album and artist views 2023-03-01 00:13:31 -05:00
0a9279dbd4 Super hack for chart pages 2023-02-28 22:11:37 -05:00
bf3479dbc7 Skip IMDB tests that aren't used 2023-02-28 21:33:46 -05:00
a99dca246b Fix chart display 2023-02-28 01:58:22 -05:00
f76aaf6a9c Condense live charts to one function 2023-02-28 01:57:46 -05:00
ce1541bb2d Add sports API 2023-02-27 13:07:18 -05:00
d34e56aa89 Bump version to 0.11.3 2023-02-27 11:13:45 -05:00
6316d4bead Fix chart templates 2023-02-27 11:13:13 -05:00
56e5728245 Bump version to 0.11.2 2023-02-27 10:30:44 -05:00
6ff170e169 Quite a few bugs 2023-02-27 10:30:20 -05:00
86d1cf0d65 Bump version to 0.11.1 2023-02-26 23:27:17 -05:00
a0101bf1ae Add first pass at AudioDB fetching 2023-02-26 23:26:51 -05:00
457afdc9ef Big fix to aggregation 2023-02-26 22:21:49 -05:00
d5bf6440b0 Bump version to 0.11.0 2023-02-26 02:00:37 -05:00
803ed7d8d7 Add base chart view 2023-02-26 02:00:15 -05:00
93c4dd3d3b Fix aggregation 2023-02-26 01:56:11 -05:00
ab728de75f Bump version to 0.10.2 2023-02-23 11:24:33 -05:00
04b7214795 Fix jellyfin scrobbling 2023-02-23 11:23:01 -05:00
479fee6a5c Its a webhook, not a websocket 2023-02-23 11:03:19 -05:00
40a126cf8b Add sportsdb event id to scrobbles 2023-02-23 10:59:58 -05:00
83c02aa00f Oops, need to move webhook urls around 2023-02-23 10:56:36 -05:00
0f44df2b9b Add subtitle field to media objects 2023-02-23 10:56:21 -05:00
16d1dcc125 Fix column flow on main page 2023-02-23 10:56:03 -05:00
927d0be1b8 Bump version to 0.10.1 2023-02-23 10:14:41 -05:00
f6b9245b8b Add looking tracks without MB IDs by looking them up 2023-02-23 10:07:29 -05:00
39e035b460 Clean up URLs and templates 2023-02-21 00:17:31 -05:00
cf9da39967 Update API to be more complete 2023-02-20 17:08:54 -05:00
2e98850494 Bump version to 0.10.0 2023-02-20 02:06:53 -05:00
5d315b4834 Fix LastFM and add UI for KoReader 2023-02-20 02:06:17 -05:00
6ef8238442 Add book scrobbling 2023-02-19 22:19:01 -05:00
f4a444354d Fix lastfm import errors 2023-02-19 22:18:11 -05:00
0db5bbe36c Fix users not being added to tsv and lastfm imports 2023-02-17 14:05:06 -05:00
69b6364f88 Update todos and add Procfile/honcho 2023-02-17 13:57:50 -05:00
966aeefbdd Turns out I shoulda tested this more 2023-02-17 13:25:56 -05:00
d944fdd0c0 Bump version to 0.9.3 2023-02-16 23:58:27 -05:00
e345631e27 Spin TSV imports off to tasks 2023-02-16 23:58:06 -05:00
59d0108fe5 Bump version to 0.9.2 2023-02-16 23:47:48 -05:00
8d67b672f9 Oops, fix the source thing properly 2023-02-16 23:47:12 -05:00
376650f937 Bump version to 0.9.1 2023-02-16 23:42:45 -05:00
485fbd63a3 Fix a few issues with TSV imports 2023-02-16 23:42:25 -05:00
d3f059caab Bump version to 0.9.0 2023-02-16 22:32:31 -05:00
bb9936af65 Clean up lastfm importing 2023-02-16 22:31:46 -05:00
9568726bf3 Switch log statement to info in lastfm 2023-02-16 02:44:57 -05:00
4ae70ef1f1 Fix celery task running 2023-02-16 02:38:30 -05:00
21df4e0a77 Add task to sync with last.fm 2023-02-16 02:27:39 -05:00
cc82504262 Fix scrobbling tracks with featured artists 2023-02-16 02:13:52 -05:00
c7b84b27b2 Fix bug in duplicate lastfm scrobbles 2023-02-15 01:41:10 -05:00
20528b576b Fix lastfm importing 2023-02-15 01:33:12 -05:00
817ad3f67f Remove django-cachalot, more problems than solutions 2023-02-15 01:32:33 -05:00
b47ca53c5d Fix source for import from Rockbox 2023-02-15 01:31:27 -05:00
7a7c1caecc Add Last.fm importing 2023-02-14 01:48:53 -05:00
87f068dccd Update tsv to use utility functions 2023-02-13 18:31:57 -05:00
31907ed1b2 Fix appending count to TSV log 2023-02-12 17:03:30 -05:00
36d7950859 Fix bug in scrobbling duplicate tracks from TSV 2023-02-12 16:54:45 -05:00
0e4501cad3 Bump version to 0.8.6 2023-02-08 20:01:09 -05:00
71e4ff28c8 Add musicbrainz utilities 2023-02-08 20:00:46 -05:00
9f272df99c Fix fetching release group and cover images 2023-02-08 20:00:09 -05:00
8ba8ceefb8 Bump version to 0.8.5 2023-02-07 01:30:38 -05:00
9590cd0f60 Fix fetching artwork when importing tsv 2023-02-07 01:30:04 -05:00
5e7c8ff137 Bump version to 0.8.4 2023-02-07 00:52:11 -05:00
fae59849f8 Add mb lookups to TSV imports 2023-02-07 00:51:43 -05:00
837e1280bd Bump version to 0.8.3 2023-02-06 23:30:14 -05:00
8f9c825903 Fix user timezones in scrobbler files 2023-02-06 23:28:57 -05:00
541073aae3 Bump version to 0.8.2 2023-02-06 19:32:15 -05:00
b63ec6b15f Fix bug in export when artist does not exist 2023-02-06 19:31:25 -05:00
117157e3ae Fix audioscrobbler import bug
Issue was not having a user so we couldn't set a timezone. All fixed now
2023-02-06 19:30:58 -05:00
0c10e78d5e Fix bug in unified scrobbler for podcasts 2023-02-06 17:54:48 -05:00
6b7359707b Bump version to 0.8.1 2023-02-06 01:12:33 -05:00
e0295cbd56 Fix jellyfin edge case scrobbling mess
Finally get to resolve scrobbling music from Jellyfin. This may lead to
other issues, in fact now videos seem to sometimes create duplicate
scrobbles. But music can be scrobbled now from Jellyfin web or Finamp
successfully.
2023-02-06 00:22:10 -05:00
5271cfaea4 Create sport if it doesn't exist yet 2023-02-06 00:19:47 -05:00
0370b64351 Fix exporting only tracks by default 2023-02-06 00:19:07 -05:00
9ec31ba0f5 Remove noisy debug logging 2023-02-05 01:59:24 -05:00
a9de298057 Put import and export behind auth 2023-02-05 01:58:19 -05:00
9d303b1b94 Add exporting and importing scrobbles 2023-02-04 17:08:01 -05:00
4c434aeb7c Bump version to 0.8.0 2023-02-03 19:00:32 -05:00
64d9cac09c Update importing to include some logging 2023-02-03 18:59:48 -05:00
c21d6a96fe Fix unused imports in imdb module 2023-02-03 16:53:03 -05:00
e392477dc7 Add import of Audioscrobbler files
Here we add a model for holding Audioscrobbler imports and some code to
process the tab-separated files we get from Rockbox.
2023-02-03 16:45:31 -05:00
12087460f6 Irritating that poetry can't handle prod deps well 2023-01-31 10:44:39 -05:00
4b4fbf4777 Bump version to 0.7.5 2023-01-31 10:41:40 -05:00
ca57eabf87 Another attempt to fix the Jellyfin issue
This time, we simplify the progress updates, aggressively mark tracks as
100 played if they are marked played_to_completion, and implement a hack
for Jellyfin spamming us with progress updates less than a second apart.
2023-01-31 10:28:54 -05:00
6fc51d9296 Fix resurrecting past tracks
This may also be hack, but I think that if the playback position ticks
are automatically jumped to the run time ticks of the media object, it
should stop the resurrection of past scrobbles, because they will be
appropriately marked as being 100 played when the scrobble is finished.

The only weirdness here is that "in progress" scrobbles will suddenly
complete once the media type's threshold is met (90, 95 percent,
whatever). But it should be better than overwriting old scrobbles.
2023-01-30 23:18:42 -05:00
6e582e25e3 Bump version to 0.7.4 2023-01-30 18:32:31 -05:00
eed344ae46 Add the beginnings of charts
This commit adds a lot of files, but most of them have no impact on any
other code. The thrust here is to start creating chart pages showing
which tracks and artists were most played for various time periods. Lots
still not working, but we're getting there.
2023-01-30 18:29:18 -05:00
41570dc2f9 Fix duplicate Jellyfin music scrobbling bug
Solution is identical to what we were already doing with videos.  When
looking for existing scrobbles, don't filter by completion, but just
check if the scrobble was played to completion.  This does create
another irritating situation where old scrobbles from days, months or
even years ago that were not played to completion will be resurrected
and made current here. But that's way less annoying than having spam
scrobbles at the end of every track.
2023-01-30 18:25:27 -05:00
24c3f5b4d8 Bump version to 0.7.3 2023-01-29 14:41:05 -05:00
703dc3c181 Add a sample envrc file 2023-01-29 14:32:25 -05:00
93550c5734 Allow looking up artwork by release group
Historically we'd just fail if the specific MB release did not have
artwork, but this is silly. If the release itself does not have artwork,
we should also check the release group failing.
2023-01-29 14:31:31 -05:00
951fa225bb Add todos and get them updated 2023-01-29 14:31:12 -05:00
2e7470688d Update TODOs and fix tests 2023-01-24 16:44:11 -05:00
8ac938bd12 Should probably avoid bug fixing under hydrocodone 2023-01-24 15:25:19 -05:00
160f15a101 Add cover art to latest listening 2023-01-24 15:24:41 -05:00
b6e0607aab Fix jellyfin video scrobbles for real 2023-01-24 02:41:48 -05:00
bbbcfca04f Add a rudimentary todo doc 2023-01-23 12:01:26 -05:00
ace0d1d9fe Bump version to 0.7.2
- Add django-redis to deps
- Use django-redis to fix cachalot issue
2023-01-22 18:36:56 -05:00
b0fb62bdb9 Upgrade to django-redis for cachalot 2023-01-22 18:36:36 -05:00
7796ff5786 Bump version to 0.7.1 2023-01-22 18:34:23 -05:00
2285c5bfd6 Fix bug in jellyfin scrobbler 2023-01-22 18:34:02 -05:00
132d63bb5d Bump version to 0.7.0 2023-01-22 18:29:29 -05:00
49bf57dd58 Copmletely rejigger sports to accomodate tennis 2023-01-22 18:27:33 -05:00
506de848d7 Pull client name from Jellyfin if provided 2023-01-21 23:57:25 -05:00
d05256f249 Add authorization and per-user scrobbling
The webhook endpoints now require a token before it will accept a
scrobble. That auth then provides the user to assign the scrobble to.
2023-01-21 23:41:35 -05:00
646c7ab99c Add ability to cancel and finish manual scrobbles 2023-01-20 14:03:23 -05:00
7fc3705455 Fix a bug in IMDB lookups for episodes 2023-01-20 13:23:23 -05:00
cbe4abfb5f First tests for imdb module 2023-01-20 13:02:32 -05:00
13bdc201f0 Add more hacky tests 2023-01-20 00:09:45 -05:00
4f5ea7cd25 Fix aggregator tests to use users and time-machine 2023-01-20 00:01:34 -05:00
b3b3b28b92 Add tests for top_tracks 2023-01-19 23:52:01 -05:00
9ed3d034cf Fix shadowed test function 2023-01-19 21:52:23 -05:00
8e4a41a279 Update gitignore file 2023-01-19 20:49:16 -05:00
0cdde59de4 Add aggregator tests 2023-01-19 20:49:01 -05:00
65e713e43e Remove some files from coverage 2023-01-19 15:37:47 -05:00
0d95f8fee8 Fix bug in unique tracks on different albums 2023-01-19 15:20:26 -05:00
6712e38689 Update drone badge to use main branch 2023-01-19 14:53:06 -05:00
4ed5fde672 Update coverage map 2023-01-19 14:52:16 -05:00
1c5f721723 Fix coverage argument 2023-01-19 14:48:33 -05:00
39547c6e5c Add a test conf file 2023-01-19 14:47:54 -05:00
7447a97117 Add coverage run to drone 2023-01-19 14:44:51 -05:00
6aa933d13d Fix bad test imports 2023-01-19 14:41:02 -05:00
3bb73ae4be Add init files to tests 2023-01-19 14:34:10 -05:00
a57269b09a Run pytest with drone 2023-01-19 14:30:04 -05:00
68423488ff Start adding tests 2023-01-19 14:29:25 -05:00
e75c22d583 Add timezone support and an authenticated view 2023-01-18 00:39:12 -05:00
a0af0bce05 Add user profile with a timezone 2023-01-17 22:20:00 -05:00
fd984d7460 Replace weekly artists with monthly 2023-01-17 17:23:13 -05:00
065fc98a87 Fix bug in Jellyfin scrobbling
We need to have a default value when we pop off a dictionary, and we
need to clear both mopidy and jellyfin status before we look a scrobble
up.

We may also want simplify status so we don't have mopidy and jellyfin cruft.
2023-01-17 16:38:17 -05:00
6db5a00917 Fix caching issue with fixed 5 minute timeout 2023-01-17 13:33:21 -05:00
734aa6073b Add cachalot to help fix slow views 2023-01-17 13:09:43 -05:00
77362d3207 Fix scrobble spam from Jellyfin
The issue here was that we update a Jellyfin scrobble to be complete
when it hits a certain threshold of percentage played (90) and then we
stop finding that scrobble while the video finishes playing. This
happens over and over again, so once a video reaches 90 percent played
we get dozens more scrobbles for each update as the video finishes
playing.

This is a crude fix, for the spam, as we'll end up "resuming" videos
that are stopped at 95 percent. So we need some way to mark the scrobble
as complete.  I think forcing the percent to 100 on finish might work.
2023-01-17 11:41:48 -05:00
9d4db65b3c Remove whitenoise compression storage 2023-01-17 00:13:28 -05:00
e850d46539 Clean up gitignore a little 2023-01-17 00:11:14 -05:00
907ef802bc Bump version to 0.6.2
Releases

* Fix for double scrobbling
* Fix error messages
* Fix bug in IMDB lookup when runtime is missing
* Fix filter order with annotations for top tracks and artists
* Fix error in completion percentage issues
2023-01-17 00:05:54 -05:00
d700b581a1 Fix filter order with annotations
We were getting all artists of all time, not just for the time period
2023-01-17 00:02:20 -05:00
7605c672f6 Fix str rep for scrobbles 2023-01-16 23:54:19 -05:00
8d1df806d7 Fix IMDB fetch when runtimes are not present 2023-01-16 23:46:04 -05:00
0f562b7c58 Fix resume bug, stop trying to avoid resuming
Turns out trying to not resume in-progress Scrobbles is super painful.
Maybe I'll come up with a better idea later, but for now, I'd rather
just resurrect old paused scrobbles of past tracks, rather than
completely mess up all other aspects of scrobbling.
2023-01-16 23:44:49 -05:00
fe53b68714 Fix silly error message 2023-01-16 20:40:02 -05:00
7e2915850f Fix double scrobbling for real 2023-01-16 20:39:27 -05:00
90687a6b43 Fix complicated completion percentage 2023-01-16 19:36:10 -05:00
07cfb03eb6 Fix really irritating double scrobble bug 2023-01-16 19:34:40 -05:00
58be8d26a0 Bump version to 0.6.1 2023-01-16 17:53:14 -05:00
0fede269b1 Fix checking for completion percentages 2023-01-16 17:52:07 -05:00
6cdcf4ff6f Fix Mopidy resuming messing things up 2023-01-16 16:12:01 -05:00
0634b94368 Fix how we calcualte resuming a scrobble 2023-01-16 13:43:14 -05:00
0ab7c563cf Fix favicon static files and logging 2023-01-15 19:06:54 -05:00
363a132df2 Bump version to 0.6.0 2023-01-15 02:42:14 -05:00
c484905d11 Add manual scrobbling by TheSportsDB ID 2023-01-15 02:41:36 -05:00
0378dfe6eb Add drone badge 2023-01-15 01:45:35 -05:00
c39443e35b Bump versoin to 0.5.1 2023-01-15 01:43:36 -05:00
bb3dfdf7ba Fix small debug log error 2023-01-15 01:42:46 -05:00
fdfb8a635e Add monthly tracks to homepage 2023-01-15 01:40:41 -05:00
290e6dc8d9 Fixing flow for mopidy scrobble 2023-01-15 01:20:18 -05:00
499546503c Fix README to use markdown 2023-01-14 16:46:46 -05:00
bd3a381346 Add sports as a preliminary scobble type 2023-01-14 16:42:48 -05:00
e206a7fbf3 Fix display of TV episode and season on homepage 2023-01-14 10:37:38 -05:00
6313da9868 Work towards unifiying manual scrobbling 2023-01-13 17:56:44 -05:00
f7c69a6763 Bump version to 0.5.0 2023-01-13 17:15:33 -05:00
ab88fcb9a7 Fix lookup bug in track year 2023-01-13 17:15:13 -05:00
1d868d3075 Add manual scrobble to main page 2023-01-13 17:12:50 -05:00
5b07c70ca2 Add scrobble inlines to admin classes 2023-01-13 17:06:29 -05:00
9607fb2d1e Make way for more manual scrobbling options ...
Next stop, sports games!
2023-01-13 16:52:45 -05:00
e6cf126f5c Add rudimentary manual scrobbling 2023-01-13 16:47:06 -05:00
eeee6eea4e Fix seconds calculator 2023-01-13 14:26:25 -05:00
1f26931215 Fix Now playing widget 2023-01-13 00:14:50 -05:00
610ec63cbd Fix bug in non-series video not scrobbling
THe season and episode numbers need to be None, not an empty string.
2023-01-13 00:01:34 -05:00
72fded4097 Bump version to 0.4.3 2023-01-12 23:51:58 -05:00
d5eea53a01 Actually fix bug in loading extra video meta 2023-01-12 23:51:10 -05:00
a49eb31276 Add podcasts to template list 2023-01-12 23:50:57 -05:00
c1e1160db3 Bump version to 0.4.2 2023-01-12 23:39:11 -05:00
0e17831724 Fix bug in load extra video info 2023-01-12 23:38:34 -05:00
045fad8552 Remove errant base template 2023-01-12 22:59:29 -05:00
a09c6d6b92 Bump version to 0.4.1 2023-01-12 21:34:17 -05:00
3f8b29f5ee Dramatically simplify the scrobblig code 2023-01-12 21:33:45 -05:00
599 changed files with 43654 additions and 2839 deletions

7
.coveragerc Normal file
View File

@ -0,0 +1,7 @@
[run]
omit=
vrobbler/wsgi.py
vrobbler/asgi.py
vrobbler/cli.py
*admin.py
migrations/*

View File

@ -4,25 +4,65 @@
################
kind: pipeline
name: run_tests
name: build & deploy
steps:
# Run tests against Python/Flask engine backend (with pytest)
- name: django_tests
image: python:3.10.4
- name: pytest with coverage
image: python:3.11.1
commands:
# Install dependencies
- cp vrobbler.conf.example vrobbler.conf
- cp vrobbler.conf.test vrobbler.conf
- pip install poetry
- poetry install
- poetry install --with test
# Start with a fresh database (which is already running as a service from Drone)
- poetry run python manage.py test
- poetry run pytest -n 5 --cov-report term:skip-covered --cov=vrobbler tests
environment:
VROBBLER_DATABASE_URL: sqlite:///test.db
volumes:
# Mount pip cache from host
- name: pip_cache
path: /root/.cache/pip
- name: deploy
image: appleboy/drone-ssh
settings:
host:
- vrobbler.service
username: root
ssh_key:
from_secret: jail_key
command_timeout: 2m
script:
- pip uninstall -y vrobbler
- pip install git+https://code.unbl.ink/secstate/vrobbler.git@main
- vrobbler migrate
- vrobbler collectstatic --noinput
- immortalctl restart celery && immortalctl restart vrobbler
when:
ref:
- refs/tags/*
- name: build success notification
image: parrazam/drone-ntfy:0.3-linux-amd64
when:
status: [success]
settings:
url: https://ntfy.unbl.ink
topic: drone
priority: low
tags:
- failure
- vrobbler
- name: build failure notification
image: parrazam/drone-ntfy:0.3-linux-amd64
when:
status: [failure]
settings:
url: https://ntfy.unbl.ink
topic: drone
priority: high
tags:
- success
- vrobbler
volumes:
- name: docker
host:

31
.github/workflows/django.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Django CI
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.9, 3.11, 3.12]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install
- name: Run Tests
run: |
pytest

7
.gitignore vendored
View File

@ -1,4 +1,5 @@
db.sqlite3
db.sqlite3*
vrobbler.conf
/media/
/dist/
media/
dist/
.coverage

6
Makefile Normal file
View File

@ -0,0 +1,6 @@
deploy:
ssh vrobbler.service "rm -rf /usr/local/lib/python3.11/site-packages/vrobbler-0.15.4.dist-info/ && pip install git+https://code.unbl.ink/secstate/vrobbler.git@develop && immortalctl restart vrobbler && immortalctl restart vrobbler-celery && vrobbler migrate"
logs:
ssh life.unbl.ink tail -n 100 -f /var/log/vrobbler.json
test:
pytest vrobbler

856
PROJECT.org Normal file
View File

@ -0,0 +1,856 @@
#+title: Vrobbler Project
* Overview
* Features
** Beer
*** Triggers
**** Bookmarklet
**** Manual
*** Metadata sources
**** Untappd
** Book
*** Triggers
**** Webdav via KoReader
**** Manual
*** Metadata sources
**** Google Books
This is the preferred method at this time. Also, the Book model implements a
`find_or_create` classmethod which is an example of an interface we can use for
other data models to get metadata in a way that provides easy testing, bulk
fetching and simple saving.
**** OpenLibrary
**** ComicVine
** Board Game
*** Triggers
**** IMAP import
**** Bookmarklet
**** Manual
** Location
*** Triggers
**** GPSLogger (Android)
*** Metadata sources
**** User input
** Music
*** Triggers
**** Last.FM
**** Rockbox files
**** Mopidy
**** Jellyfin
*** Metadata sources
**** Musicbrainz
** Podcast
*** Triggers
**** Mopidy
*** Metadata sources
**** Google Podcasts
**** PodcastIndex
** Sport
*** Triggers
**** Bookmarklet
**** Manual
*** Metadata sources
**** Thes Sports DB
** Task
*** Triggers
**** Todoist
**** Org-mode
*** Metadata sources
**** User profile
** Trails
** Video
*** Triggers
**** Jellyfin
**** Bookmarklet
**** Manual
*** Metadata sources
**** IMDB
**** Youtube
** Web Page
*** Triggers
**** Bookmarklet
*** Metadata sources
**** Scraper
* Release history
* Chores
** DONE Document various vrobbler features :chore:personal:project:vrobbler:documentation:
:PROPERTIES:
:ID: 514e9285-96f1-265f-56df-118c12f60918
:END:
:LOGBOOK:
CLOCK: [2025-07-09 Wed 09:55]--[2025-07-09 Wed 10:15] => 0:20
:END:
* Backlog [3/23]
** TODO [#A] Add classmethod for metadata fetching to tracks :vrobbler:feature:music:personal:project:
:PROPERTIES:
:ID: bc4b45e5-4c65-13c5-ab7b-1937d3fbf5c2
:END:
:LOGBOOK:
CLOCK: [2025-07-09 Wed 10:15]
:END:
** TODO Add importer class for IMAP imports :vrobbler:feature:imap:importers:project:personal:
** TODO Add youtube link in place of IMDB on video detail page :vrobbler:feature:videos:personal:project:
** TODO [#A] Tasks from org-mode should properly update notes and leave them out of the body :vrobbler:bug:tasks:
** TODO [#A] Fix small bug in views for TV series where next episode is now None :vrobbler:bug:personal:videos:
#+begin_src python
ERROR django.request:241 log_response Internal Server Error: /series/c24100d1-da45-4abe-86bf-27cfce9b1f89/
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
return super().dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
return handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/views/generic/detail.py", line 109, in get
context = self.get_context_data(object=self.object)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/vrobbler/apps/videos/views.py", line 33, in get_context_data
context_data["next_episode_id"] = "tt" + next_episode_id
~~~~~^~~~~~~~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str
#+end_src
** TODO [#A] Send periodic check notifications for board games and beer that ask if you're still scrobbling :vrobbler:personal:project:beers:boardgames:notifications:feature:
** TODO [#A] Fix raw text webpage title not truncating to 254 chars :vrobbler:personal:bug:webpages:
** TODO [#A] Fix koreader scrobble imports to use DST properly :vrobbler:personal:bug:books:imports:
The page data has the canonical date something was read in it, but it seems to be an hour off. I traced this back to being off during DST, so we just need the importer to be aware of whether a user is using DST or not and roll back an hour for part of the year.
Also, we'd need to adjust any old scrobbles that took place with DST off to roll them back by an hour.
** TODO [#A] Create small utility to clean up tracks scrobbled with wonky playback times :vrobbler:personal:bug:music:scrobbles:
** TODO [#B] Add AllTrails as a source for Trail data :vrobbler:trails:feature:personal:project:
Pretty clear, I would love to make trails more useful. Historically I wasn't
hiking a lot, which made the source for this a bit silly. But it's clear that
AllTrails is the best source, though having TrailForks is nice to.
** TODO [#B] Add `garmin_activity_id` to the TrailMetadataLog class :vrobbler:trails:feature:personal:project:
Would be nice to have some loose connection to the actual event in my Garmin profile.
** TODO [#B] Explore a way to add metadata editing to scrobbles after saving :vrobbler:spike:scrobbling:personal:project:
Could be as simple as a JSON form on the scrobble detail page (do I have have one of those yet?).
** TODO [#B] Explore a good way to show notes and descriptions from scrobbles to users :personal:project:scrobbling:vrobbler:spike:
** TODO [#B] Add webdav syncing to retroarch imports :vrobbler:videogames:webdav:feature:project:personal:
** TODO [#B] Add CSV endpoint for book scrobbles that LibraryThing can ingest :personal:project:books:feature:export:
https://app.todoist.com/app/task/add-a-csv-endpoint-for-users-book-reads-that-library-thing-can-ingest-6X7QPMRp265xMXqg#comment-6X7QrXq6gJjMP4hg
** TODO [#C] Fix bug where podcast scrobbling creates duplicate Podcast :project:vrobbler:scrobbling:podcasts:bug:personal:
Rather than pick up an existing Podcast using the podcast title in the mopidy
file name, Vrobbler creates a new podcast with no enriched data. Not a big deal
for my use as the volume of podcasts I listen to makes manual fixes easy. But
it's annoying.
** TODO [#C] Move to using more robust mopidy-webhooks pacakge form pypi :utility:improvement:
:PROPERTIES:
:ID: ab31fdc3-359c-1b1d-6b9d-546b476021ba
:END:
*** Example payloads from mopidy-webhooks
**** Podcast playback ended
#+begin_src json
{
"type": "event",
"event": "track_playback_ended",
"data": {
"tl_track": {
"__model__": "TlTrack",
"tlid": 13,
"track": {
"__model__": "Track",
"uri": "file:///var/lib/mopidy/media/podcasts/The%20Prince/2022-09-28-Wolf-warriors.mp3",
"name": "Wolf warriors",
"artists": [
{
"__model__": "Artist",
"name": "The Economist"
}
],
"album": {
"__model__": "Album",
"name": "The Prince",
"date": "2022"
},
"genre": "Blues",
"date": "2022",
"length": 2437778,
"bitrate": 127988
}
},
"time_position": 3290
}
}
#+end_src
**** Podcast playback state changes
#+begin_src json
{
"type": "event",
"event": "playback_state_changed",
"data": {
"old_state": "paused",
"new_state": "playing"
}
}
#+end_src
#+begin_src json
{
"type": "event",
"event": "playback_state_changed",
"data": {
"old_state": "stopped",
"new_state": "playing"
}
}
#+end_src
**** Podcast playback started
#+begin_src json
{
"type": "event",
"event": "track_playback_started",
"data": {
"tl_track": {
"__model__": "TlTrack",
"tlid": 13,
"track": {
"__model__": "Track",
"uri": "file:///var/lib/mopidy/media/podcasts/The%20Prince/2022-09-28-Wolf-warriors.mp3",
"name": "Wolf warriors",
"artists": [
{
"__model__": "Artist",
"name": "The Economist"
}
],
"album": {
"__model__": "Album",
"name": "The Prince",
"date": "2022"
},
"genre": "Blues",
"date": "2022",
"length": 2437778,
"bitrate": 127988
}
}
}
}
#+end_src
**** Podcast playback paused
#+begin_src json
{
"type": "status",
"data": {
"state": "paused",
"current_track": {
"__model__": "Track",
"uri": "file:///var/lib/mopidy/media/podcasts/The%20Prince/2022-09-28-Wolf-warriors.mp3",
"name": "Wolf warriors",
"artists": [
{
"__model__": "Artist",
"name": "The Economist"
}
],
"album": {
"__model__": "Album",
"name": "The Prince",
"date": "2022"
},
"genre": "Blues",
"date": "2022",
"length": 2437778,
"bitrate": 127988
},
"time_position": 2350
}
}
#+end_src
**** Track playback started
#+begin_src json
{
"type": "event",
"event": "track_playback_started",
"data": {
"tl_track": {
"__model__": "TlTrack",
"tlid": 14,
"track": {
"__model__": "Track",
"uri": "local:track:Various%20Artists%20-%202008%20-%20Twilight%20OST/01-muse-supermassive_black_hole.mp3",
"name": "Supermassive Black Hole",
"artists": [
{
"__model__": "Artist",
"uri": "local:artist:md5:250dd6551b66a58a6b4897aa697f200c",
"name": "Muse",
"musicbrainz_id": "9c9f1380-2516-4fc9-a3e6-f9f61941d090"
}
],
"album": {
"__model__": "Album",
"uri": "local:album:md5:455343d54cdd89cb5a3b5ad537ea99d0",
"name": "Twilight: Original Motion Picture Soundtrack",
"artists": [
{
"__model__": "Artist",
"uri": "local:artist:md5:54e4db2d5624f80b0cc290346e696756",
"name": "Various Artists",
"musicbrainz_id": "89ad4ac3-39f7-470e-963a-56509c546377"
}
],
"num_tracks": 12,
"num_discs": 1,
"date": "2008-11-04",
"musicbrainz_id": "b4889eaf-d9f4-434c-a68d-69227b12b6a4"
},
"composers": [
{
"__model__": "Artist",
"uri": "local:artist:md5:4d49cbca0b347e0a89047bb019d2779d",
"name": "Matt Bellamy"
}
],
"genre": "Rock",
"track_no": 1,
"disc_no": 1,
"date": "2008-11-04",
"length": 211121,
"musicbrainz_id": "ff1e3e1a-f6e8-4692-b426-355880383bb6",
"last_modified": 1672712949510
}
}
}
}
#+end_src
**** Track playback in progress
#+begin_src json
{
"type": "status",
"data": {
"state": "playing",
"current_track": {
"__model__": "Track",
"uri": "local:track:Various%20Artists%20-%202008%20-%20Twilight%20OST/01-muse-supermassive_black_hole.mp3",
"name": "Supermassive Black Hole",
"artists": [
{
"__model__": "Artist",
"uri": "local:artist:md5:250dd6551b66a58a6b4897aa697f200c",
"name": "Muse",
"musicbrainz_id": "9c9f1380-2516-4fc9-a3e6-f9f61941d090"
}
],
"album": {
"__model__": "Album",
"uri": "local:album:md5:455343d54cdd89cb5a3b5ad537ea99d0",
"name": "Twilight: Original Motion Picture Soundtrack",
"artists": [
{
"__model__": "Artist",
"uri": "local:artist:md5:54e4db2d5624f80b0cc290346e696756",
"name": "Various Artists",
"musicbrainz_id": "89ad4ac3-39f7-470e-963a-56509c546377"
}
],
"num_tracks": 12,
"num_discs": 1,
"date": "2008-11-04",
"musicbrainz_id": "b4889eaf-d9f4-434c-a68d-69227b12b6a4"
},
"composers": [
{
"__model__": "Artist",
"uri": "local:artist:md5:4d49cbca0b347e0a89047bb019d2779d",
"name": "Matt Bellamy"
}
],
"genre": "Rock",
"track_no": 1,
"disc_no": 1,
"date": "2008-11-04",
"length": 211121,
"musicbrainz_id": "ff1e3e1a-f6e8-4692-b426-355880383bb6",
"last_modified": 1672712949510
},
"time_position": 17031
}
}
#+end_src
**** Track event playback paused
#+begin_src json
{
"type": "event",
"event": "track_playback_paused",
"data": {
"tl_track": {
"__model__": "TlTrack",
"tlid": 14,
"track": {
"__model__": "Track",
"uri": "local:track:Various%20Artists%20-%202008%20-%20Twilight%20OST/01-muse-supermassive_black_hole.mp3",
"name": "Supermassive Black Hole",
"artists": [
{
"__model__": "Artist",
"uri": "local:artist:md5:250dd6551b66a58a6b4897aa697f200c",
"name": "Muse",
"musicbrainz_id": "9c9f1380-2516-4fc9-a3e6-f9f61941d090"
}
],
"album": {
"__model__": "Album",
"uri": "local:album:md5:455343d54cdd89cb5a3b5ad537ea99d0",
"name": "Twilight: Original Motion Picture Soundtrack",
"artists": [
{
"__model__": "Artist",
"uri": "local:artist:md5:54e4db2d5624f80b0cc290346e696756",
"name": "Various Artists",
"musicbrainz_id": "89ad4ac3-39f7-470e-963a-56509c546377"
}
],
"num_tracks": 12,
"num_discs": 1,
"date": "2008-11-04",
"musicbrainz_id": "b4889eaf-d9f4-434c-a68d-69227b12b6a4"
},
"composers": [
{
"__model__": "Artist",
"uri": "local:artist:md5:4d49cbca0b347e0a89047bb019d2779d",
"name": "Matt Bellamy"
}
],
"genre": "Rock",
"track_no": 1,
"disc_no": 1,
"date": "2008-11-04",
"length": 211121,
"musicbrainz_id": "ff1e3e1a-f6e8-4692-b426-355880383bb6",
"last_modified": 1672712949510
}
},
"time_position": 67578
}
}
#+end_src
** TODO [#C] User should be able to enable auto trail tracking via amail reader with Garmin LiveTrack URLs :vrobbler:trails:project:feature:personal:
** TODO [#C] Allow users to see tasks on calendar view :vrobbler:personal:project:templates:feature:
https://codepen.io/oliviale/pen/QYqybo
** TODO [#C] Come up with a possible flow using WebDAV and super-productivity for tasks :personal:feature:project:vrobbler:tasks:
* Version 23.0 [3/3]
** DONE Add dynamic forms for LogData classes :personal:feature:vrobbler:project:forms:logdata:
:PROPERTIES:
:ID: 0db889a1-f262-fba2-7fed-ed99eded1c88
:END:
** DONE Look in comments for a timestamp for start from BG stats if the time is missing :vrobbler:feature:boardgames:project:personal:
** DONE Fix long play scrobbles to provide better data :vrobbler:feature:scrobbles:longplay:personal:project:
:PROPERTIES:
:ID: 99f6bd77-dc8f-6ed1-0321-32a52c944264
:END:
* Version 19.0 [1/1]
** DONE Add periodic check for mood :vrobbler:feature:moods:personal:project:
:PROPERTIES:
:ID: 55404488-c69f-0dd5-838e-1d1e15c873eb
:END:
* Version 18.7 [1/1]
** DONE Use the timezone history log to fix old Scrobbles that fall into those timezone blocks :vrobbler:chore:scrobbles:project:personal:
:PROPERTIES:
:ID: 9d055ac1-584b-20c8-7ad9-9ce36b329dc7
:END:
* Version 18.4 [2/2]
** DONE Track timezone changes for profiles :vrobbler:feature:profiles:personal:project:
:PROPERTIES:
:ID: 89ec867f-29fd-82f1-be17-b49dddc30c78
:END:
[2025-07-11 14:23]
** DONE Only create a LastFM import if there are files to import :vrobbler:feature:lastfm:importers:project:personal:
:PROPERTIES:
:ID: 7a1456af-c5f1-6385-b34f-0be24a6b65b0
:END:
- Note taken on [2025-07-20 Sun 16:21]
This thing is kicking my butt. As it stands it works, but the scrobbles are not assigned to the tracks properly.
* Version 18.3 [1/1]
** DONE Add timezone awarness to IMAP importer :personal:project:vrobbler:feature:importer:imap:timezones:
:PROPERTIES:
:ID: 05837b7c-96aa-6190-3678-e2ae7c7cac75
:END:
* Version 18 [4/4]
** DONE Condense tracks of the same title by the same artist with multiple albums :vrobbler:feature:music:project:personal:
:PROPERTIES:
:ID: b39fcec8-59fd-eab0-5809-b8144c7d2708
:END:
** DONE Import from BG stats a "learning" log field when "Learning to play" is in the comment :vrobbler:feature:boardgames:project:personal:
:PROPERTIES:
:ID: fda59fab-4349-e99e-54c6-9f1392a1c474
:END:
** DONE [#A] Add email importer for BG stats file uploads :vrobbler:feature:boardgames:personal:project:
:PROPERTIES:
:ID: 116fe738-7966-615c-d195-ccff0337b101
:END:
#+begin_src json example of a file
{
"about": "This is a Play file that can be read by Board Game Stats. If you see this text, try to use a share, export or open-in function to open it with Board Game Stats.",
"players": [
{
"uuid": "31f8b92e-11d8-4162-88b1-fd9c79eea249",
"id": 2,
"name": "Colin",
"isAnonymous": false,
"modificationDate": "2025-07-01 18:10:32",
"metaData": "{\"isNpc\":0}"
},
{
"uuid": "00074700-cf4e-4ad3-b334-d35805bb0d90",
"id": 4,
"name": "Asa Sewell",
"isAnonymous": false,
"modificationDate": "2025-07-01 18:03:37"
}
],
"locations": [
{
"uuid": "14f7389c-767f-4725-9b35-906c407b293c",
"id": 3,
"name": "Timberwyck Farm",
"modificationDate": "2025-07-01 18:03:38"
}
],
"games": [
{
"uuid": "043a2851-f201-467a-a60c-0b0a7e9c33d2",
"id": 333,
"name": "Ghost Fightin' Treasure Hunters: Anniversary Edition",
"modificationDate": "2025-07-02 01:37:14",
"cooperative": true,
"highestWins": true,
"noPoints": false,
"usesTeams": false,
"urlThumb": "https://cf.geekdo-images.com/DHA-mcH3zzw_OjfDxOPj1A__thumb/img/UhaIm4KIDIiraUc44QIvSAbMUXI=/fit-in/200x150/filters:strip_icc()/pic8266874.jpg",
"urlImage": "https://cf.geekdo-images.com/DHA-mcH3zzw_OjfDxOPj1A__original/img/2-Lb6nLePhn0I0Hh2j1pOtbO4rg=/0x0/filters:format(jpeg)/pic8266874.jpg",
"bggName": "Ghost Fightin' Treasure Hunters: Anniversary Edition",
"bggYear": 2024,
"bggId": 422668,
"designers": "Brian Yu",
"isBaseGame": 1,
"isExpansion": 0,
"rating": 75,
"minPlayerCount": 2,
"maxPlayerCount": 5,
"minPlayTime": 30,
"maxPlayTime": 0,
"minAge": 8
}
],
"plays": [
{
"uuid": "bae3f29e-5e1e-45d8-b409-47a665c8d5b5",
"modificationDate": "2025-07-02 01:37:59",
"entryDate": "2025-07-02 01:31:38",
"playDate": "2025-07-02 01:31:38",
"usesTeams": false,
"durationMin": 23,
"ignored": false,
"manualWinner": true,
"rounds": 3,
"scoresheet": "{\"bggId\":244711,\"version\":1,\"langCode\":\"en\",\"scoreType\":\"bestTotalWins\",\"groups\":[{\"templateId\":\"1\",\"maxRepeat\":-1,\"repetition\":1,\"hasSubTotal\":false,\"hideSingleGroupLabel\":false,\"isExtra\":false,\"rows\":[{\"templateId\":\"vptrack\",\"label\":\"VP track\",\"repetition\":1,\"repeatable\":false,\"negative\":false,\"isExtra\":false,\"scores\":{}},{\"templateId\":\"objectives\",\"label\":\"Objectives\",\"repetition\":1,\"repeatable\":false,\"negative\":false,\"isExtra\":false,\"scores\":{}},{\"templateId\":\"mastercards\",\"label\":\"Master cards\",\"repetition\":1,\"repeatable\":false,\"negative\":false,\"isExtra\":false,\"scores\":{}}]}]}",
"locationRefId": 3,
"gameRefId": 333,
"board": "",
"scoringSetting": 4,
"metaData": "{\"playUsedGameCopy\":2}",
"playerScores": [
{
"score": "",
"winner": true,
"newPlayer": true,
"startPlayer": false,
"playerRefId": 4,
"role": "",
"rank": 0,
"seatOrder": 0,
"metaData": "{\"scoreUuid\":\"00074700-cf4e-4ad3-b334-d35805bb0d90\"}"
},
{
"score": "",
"winner": true,
"newPlayer": true,
"startPlayer": false,
"playerRefId": 2,
"role": "",
"rank": 0,
"seatOrder": 0,
"metaData": "{\"scoreUuid\":\"31f8b92e-11d8-4162-88b1-fd9c79eea249\"}"
}
],
"expansionPlays": []
}
],
"userInfo": {
"meRefId": 2
}
}
#+end_src
** DONE [#B] Fix task app to only use one tag for the context a task was done in and allow configurable contexts by user profile :personal:vrobbler:feature:tasks:project:
:PROPERTIES:
:ID: 23f485e3-988c-6198-c79d-91fdf92f001c
:END:
* Version 17.0 [6/6]
** DONE [#A] Fix bug in new task label lookup for Emacs/Org-mode :vrobbler:bug:tasks:
:PROPERTIES:
:ID: 683fb109-dfc4-85e4-80f0-ea618434f61e
:END:
** DONE [#C] Replace commas in the bandcamp URL for artists with nothing :vrobbler:music:bug:personal:
:PROPERTIES:
:ID: 9b30d67b-91f0-a480-dfaa-5d9dc090e76c
:END:
- Note taken on [2025-06-16 Mon 09:36]
This firt appeared with Black Country, New Road, where the RYM slug generator
leaves commas in and ends up sending you to a 404. I suspect this wont be the
first tweak we'll need to this, as the RYM link creator is really just
guessing based on the artist name at the path.
** DONE [#A] Investigate new source of video metadata :personal:project:video:imdb:
:PROPERTIES:
:ID: df2b486c-1170-5199-c312-9bc87760d962
:END:
Cinemagoer broke and I probably should find a more reilable source of video data.
- Note taken on [2025-06-13 Fri 11:19]
TMDB is much more reliable, but does require an API key. That's all setup now,
so hopefully this breaking IMDB crap is over.
** DONE [#A] IMDB video lookups are failing :personal:bug:video:imdb:
:PROPERTIES:
:ID: 38f1081f-37b4-f4f2-79aa-c1e87eca4b69
:END:
<2025-06-13 Fri>
- Note taken on [2025-06-13 Fri 08:24]
Looks like Cinemagoer is broken: https://github.com/cinemagoer/cinemagoer/issues/537
** DONE [#A] Emacs is not syncing notes :personal:scrobbling:emacs:bug:
:PROPERTIES:
:ID: c79cd491-b30f-0945-d84b-b8cac7562791
:END:
<2025-06-12 Thu 9:30>
Not sure if the problem is in my Emacs hook sending or Vrobbler itself.
- Note taken on [2025-06-12 Thu 09:47]
Adding a quick note to check on it
- Note taken on [2025-06-12 Thu 09:50]
Ah ha. All the messing about with the source field meant that I was looking
for `emacs` as a source but the hook was initially setting sources to
`orgmode` I think I prefer `orgmode` as the source, so updating it thusly.
Fixed in `490d60cbbb1f8bf90b5fc47d8685b15bdc1d485b`
** DONE [#A] Show the description of a task in the string rep for a scrobble of a Task :personal:project:scrobbling:vrobbler:feature:
:PROPERTIES:
:ID: df58f8d0-fa4a-2037-c7d7-e5388c239042
:END:
* Version 0.16.0 [19/19]
** DONE [#A] Jellyfin, bandcamp tracks from Mopidy create duplicate music tracks :bug:scrobbling:music:
:PROPERTIES:
:ID: 670e8634-49b5-dce9-1684-14f2ffb797f1
:END:
Effectively, any track that comes in without a MusicBrainz ID does some funky
lookup where it doesn't find a track without an MB id and the track title /
artist combination and creates a new track every time. This has to be cleaned up
by condensing the duplicated tracks into the original proper track.
But it opens a bigger question about how much MB id should the drive the app
lookup. If it can't be depended on to exist from all sources, it really can't be
canonical. Instead, the combination of track title / artist is really the best
we can do. Last.fm also has this problem, where it doesn't know about albums and
definitely does not know or care about MB ids.
** DONE Add a user profile page with ability to change settings :profiles:improvement:
- Note taken on [2025-04-04 Fri 10:51]
[[orgit-rev:~/src/code.unbl.ink/secstate/vrobbler/::93c16d80ecff4cd1663cf9ec40fbe6d8f58c3e44][~/src/code.unbl.ink/secstate/vrobbler/ (magit-rev 93c16d8)]]
https://code.unbl.ink/secstate/vrobbler/commit/93c16d80ecff4cd1663cf9ec40fbe6d8f58c3e44
** DONE What to do with Youtube videos from LastFM and web-scrobbler :bug:source:lastfm:
- Note taken on [2025-04-04 Fri 10:46]
Nothing. Over the last few months I built out a youtube model in videos and
use a bookmarklet scrobbling pattern. Now web-scrobbler is just disabled for
Youtube.
May want to revisit this at some point and only scrobble tracks from Youtube,
because many people use YT for music listening.
** DONE [#C] Consider a purge command for duplicated and stuck in-progress scrobbles :utililty:improvement:
CLOSED: [2023-04-06 Thu 14:09]
** DONE Add a "stop_timestamp" so we don't rely on content length :improvement:scrobbling:
CLOSED: [2023-04-02 Sun 23:58]
Essentially, we currently have the timestamp as when the content began
scrobbling and then calculate the finish time from the length of the content.
This works pretty well because we know how long most things are.
But in some cases, sports events or long podcasts, we may start mid-way through
an event or finish halfway through but still want to mark it as done. In these
cases, knowing the finish time could be useful, especially when interfacing with
other scrobblers which may have different definitions of when a scrobble
finishes or started.
** DONE Fix bug with Various Artist albums being labeled with first artist as album artist :scrobbling:bug:music:
CLOSED: [2023-03-27 Mon 20:18]
:LOGBOOK:
CLOCK: [2023-03-26 Sun 22:01]--[2023-03-27 Mon 01:07] => 3:06
:END:
** DONE Fix bug with weekly aggregator being blank on Sundays :aggregators:music:bug:
CLOSED: [2023-03-26 Sun 13:52]
** DONE Fix KoReader scrobbling to use pages rather than time of last read :scrobbling:books:improvement:
CLOSED: [2023-03-26 Sun 13:51]
:LOGBOOK:
CLOCK: [2023-03-26 Sun 13:11]--[2023-03-26 Sun 13:51] => 0:40
:END:
** DONE [#A] Add django-storage to store files on S3 :settings:improvement:
CLOSED: [2023-03-24 Fri 14:46]
:LOGBOOK:
CLOCK: [2023-03-24 Fri 10:47]--[2023-03-24 Fri 14:46] => 3:59
CLOCK: [2023-03-24 Fri 10:36]--[2023-03-24 Fri 10:40] => 0:04
:END:
** DONE Fix vrobbler settings not using booleans :settings:bug:
CLOSED: [2023-03-24 Fri 10:45]
:LOGBOOK:
CLOCK: [2023-03-24 Fri 10:40]--[2023-03-24 Fri 10:46] => 0:06
:END:
** DONE Update weekly live chart to be 7-day continuous rather than weekly :views:bug:
CLOSED: [2023-03-24 Fri 00:31]
The live view will be blank every Monday, no reason to tie it to a day of the
week. It should be "the last 7 days"
** DONE [#B] Implement a detail view for TV shows :improvement:views:
CLOSED: [2023-03-22 Wed 17:05]
** DONE [#B] Implement a detail view for Movies :improvement:views:
CLOSED: [2023-03-22 Wed 17:05]
** DONE Add "service provider" to TV Series, and use that for source when available :bug:scrobbling:
CLOSED: [2023-03-22 Wed 17:04]
** DONE Add view for long-play content (books, video games) to restart them :views:improvement:
CLOSED: [2023-03-22 Wed 17:01]
** DONE Add live chart view like Maloja :improvement:views:
CLOSED: [2023-03-07 Tue 11:13]
** DONE [#C] Figure out how to add to web-scrobbler :improvement:scrobbling:
CLOSED: [2023-03-22 Wed 17:06]
An example:
https://github.com/web-scrobbler/web-scrobbler/blob/master/src/core/background/scrobbler/maloja-scrobbler.js
This is actually going to be moot because we can import from LastFM, and
web-scrobbler integrates well with LastFM. The only thing to think through here
now is what to do with all the garbage web-scrobbler sometimes pushes to LastFM
from Youtube (all videos get pushed, sigh).
** DONE Add Amazon scraper to look up books when OL fails :books:improvement:
This turned out to be a non-starter ... Amazon is aggressive at disallowing
scraping quality. And all the OSS tools out there are stuck in an arms race
trying to keep them from breaking.
That said, Google Books actually has a decent API (for now), and I've built this
out using that.
** DONE Fix bug in Jellyfin scrobbles that spam more scrobbles after completion :scrobbling:videos:bug:
This was fixed a while ago, but there's a new manifested bug. Going to create a
separate bug tracking ticket for that.
* Version 0.11.4 [9/9]
** DONE Add rudimentary video game scrobbling :improvement:content:videogames:
CLOSED: [2023-03-07 Tue 11:11]
** DONE Add ability to scrobble from KOReader statistics files :improvement:books:content:
CLOSED: [2023-03-07 Tue 11:11]
** DONE [#A] Fix fetching artwork without release group :bug:
CLOSED: [2023-01-29 Sun 14:27]
When we get artwork from Musicbrianz, and it's not found, we should check for
release groups as well. This will stop issues with missing artwork because of
obscure MB release matches.
** DONE [#A] Fix Jellyfin music scrobbling N+1 past 90 completion percent :bug:
CLOSED: [2023-01-30 Mon 18:31]
:LOGBOOK:
CLOCK: [2023-01-30 Mon 18:00]--[2023-01-30 Mon 18:31] => 0:31
:END:
If we play music from Jellyfin and the track reaches 90% completion, the
scrobbling goes crazy and starts creating new scrobbles with every update.
The cause is pretty simple, but the solution is hard. We want to mark a scrobble
as complete for the following conditions:
- Play stopped and percent played beyond 90%
- Play completely finished
But if we keep listening beyond 90, we should basically ignore updates (or just
update the existing scrobble)
** DONE [#A] Add support for Audioscrobbler tab-separated file uploads :improvement:
CLOSED: [2023-02-03 Fri 16:52]
An example of the format:
#+begin_src csv
,
#AUDIOSCROBBLER/1.1
#TZ/UNKNOWN
#CLIENT/Rockbox sansaclipplus $Revision$
75 Dollar Bill I Was Real I Was Real 4 1015 S 1740494944 64ff5f53-d187-4512-827e-7606c69e66ff
75 Dollar Bill I Was Real I Was Real 4 1015 S 1740494990 64ff5f53-d187-4512-827e-7606c69e66ff
311 311 Down 1 173 S 1740495003 00476c23-fd9e-464b-9b27-a62d69f3d4f4
311 311 Down 1 173 L 1740495049 00476c23-fd9e-464b-9b27-a62d69f3d4f4
311 311 Down 1 173 L 1740495113 00476c23-fd9e-464b-9b27-a62d69f3d4f4
311 311 Random 2 187 S 1740495190 530c09f3-46fe-4d90-b11f-7b63bcb4b373
311 311 Random 2 187 L 1740495194 530c09f3-46fe-4d90-b11f-7b63bcb4b373
311 311 Jackolanterns Weather 3 204 L 1740495382 cc3b2dec-5d99-47ea-8930-20bf258be4ea
311 311 All Mixed Up 4 182 L 1740495586 980a78b5-5bdd-4f50-9e3a-e13261e2817b
311 311 Hive 5 179 L 1740495768 18f6dc98-d3a2-4f81-b967-97359d14c68c
311 311 Guns (Are for Pussies) 6 137 L 1740495948 5e97ed9f-c8cc-4282-9cbe-f8e17aee5128
311 311 Misdirected Hostility 7 179 S 1740496085 61ff2c1a-fc9c-44c3-8da1-5e50a44245af
,
#+end_src
** DONE [#B] Allow scrobbling music without MB IDs by grabbing them before scrobble :improvement:
CLOSED: [2023-02-17 Fri 00:10]
This would allow a few nice flows. One, you'd be able to record the play of an
entire album by just dropping the muscibrainz_id in. This could be helpful for
offline listening. It would also mean bad metadata from mopidy would not break
scrobbling.
** DONE When updating musicbrainz IDs, clear and run fetch artwrok :improvement:
CLOSED: [2023-02-17 Fri 00:11]
** DONE [#A] Add ability to manually scrobble albums or tracks from MB :improvement:
CLOSED: [2023-03-07 Tue 11:09]
Given a UUID from musicbrainz, we should be able to scrobble an album or
individual track.
** DONE [#C] Implement keeping track of week/month/year chart-toppers :improvement:
CLOSED: [2023-03-07 Tue 11:10]
:LOGBOOK:
CLOCK: [2023-01-30 Mon 16:30]--[2023-01-30 Mon 18:00] => 1:30
:END:
Maloja does this cool thing where artists and tracks get recorded as the top
track of a given week, month or year. They get gold, silver or bronze stars for
their place in the time period.
I could see this being implemented as a separate Chart table which gets
populated at the end of a time period and has a start and end date that defines
a period, along with a one, two, three instance.
Of course, it could also be a data model without a table, where it runs some fun
calculations, stores it's values in Redis as a long-term lookup table and just
has to re-populate when the server restarts.

2
Procfile Normal file
View File

@ -0,0 +1,2 @@
web: python manage.py runserver 0.0.0.0:8014
worker: celery -A vrobbler worker -l DEBUG

View File

@ -1,4 +1,7 @@
#+title: Readme
Vrobbler
========
[![Build Status](https://ci.lab.unbl.ink/api/badges/secstate/vrobbler/status.svg?ref=refs/heads/main)](https://ci.lab.unbl.ink/secstate/vrobbler)
Vrobbler is a pretty simple Django-powered web app for scrobbling video plays from you favorite Jellyfin installation.

1
data/moods.json Normal file

File diff suppressed because one or more lines are too long

4
envrc.sample Normal file
View File

@ -0,0 +1,4 @@
export ENV_PATH=$(poetry env info --path)
source "${ENV_PATH}/bin/activate"
#export PYPI_PASSWORD="$(pass personal/apikey/pypi)"

View File

@ -6,7 +6,7 @@ import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'vrobbler.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "vrobbler.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
@ -18,5 +18,5 @@ def main():
execute_from_command_line(sys.argv)
if __name__ == '__main__':
if __name__ == "__main__":
main()

6607
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,22 +1,23 @@
[tool.poetry]
name = "vrobbler"
version = "0.4.0"
version = "0.16.1"
description = ""
authors = ["Colin Powell <colin@unbl.ink>"]
[tool.poetry.dependencies]
python = "^3.8"
python = ">=3.9,<3.12"
Django = "^4.0.3"
django-extensions = "^3.1.5"
python-dateutil = "^2.8.2"
python-dotenv = "^0.20.0"
python-json-logger = "^2.0.2"
colorlog = "^6.6.0"
httpx = "<=0.27.2"
djangorestframework = "^3.13.1"
Markdown = "^3.3.6"
django-filter = "^21.1"
Pillow = "^9.0.1"
psycopg2 = {version = "^2.9.3", extras = ["production"]}
psycopg2 = "^2.9.3"
dj-database-url = "^0.5.0"
django-mathfilters = "^1.0.0"
django-allauth = "^0.50.0"
@ -26,29 +27,65 @@ django-taggit = "^2.1.0"
django-markdownify = "^0.9.1"
gunicorn = "^20.1.0"
django-simple-history = "^3.1.1"
whitenoise = "^6.3.0"
musicbrainzngs = "^0.7.1"
cinemagoer = "^2022.12.27"
pysportsdb = "^0.1.0"
pytz = "^2022.7.1"
django-redis = "^5.2.0"
pylast = "^5.1.0"
django-encrypted-field = "^1.0.5"
celery = "^5.2.7"
honcho = "^1.1.0"
howlongtobeatpy = "^1.0.5"
beautifulsoup4 = "^4.11.2"
django-storages = "^1.13.2"
stream-sqlite = "^0.0.41"
ipython = "^8.14.0"
pendulum = "^2.1.2"
trafilatura = "^1.6.3"
django-imagekit = "^5.0.0"
thefuzz = "^0.22.1"
dataclass-wizard = "0.22.0"
webdavclient3 = "^3.14.6"
boto3 = "^1.35.37"
urllib3 = "<2"
django-oauth-toolkit = "^3.0.1"
meta-yt = "^0.1.9"
berserk = "^0.13.2"
poetry-bumpversion = "^0.3.3"
orgparse = "^0.4.20250520"
tmdbv3api = "^1.9.0"
themoviedb = "^1.0.2"
[tool.poetry.dev-dependencies]
[tool.poetry.group.test]
optional = true
[tool.poetry.group.test.dependencies]
Werkzeug = "2.0.3"
black = "^22.3"
freezegun = "^1.2"
coverage = "^7.0.5"
mypy = "^0.961"
pytest = "^7.1"
pytest-black = "^0.3.12"
pytest-cov = "^3.0"
pytest-django = "^4.5.2"
pytest-xdist= "^1.0.0"
pytest-flake8 = "^1.1"
pytest-isort = "^3.0"
pytest-runner = "^6.0"
pytest-selenium = "^2.0.1"
time-machine = "^2.9.0"
types-pytz = "^2022.1"
types-requests = "^2.27"
types-freezegun = "^1.1"
bandit = "^1.7.4"
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra -q --reuse-db"
testpaths = ["tests"]
DJANGO_SETTINGS_MODULE='vrobbler.settings-testing'
[tool.black]
line-length = 79
skip-string-normalization = true
target-version = ["py39", "py310"]
include = ".py$"
exclude = "migrations"

View File

@ -1,25 +0,0 @@
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Untitled</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">
You are using an <strong>outdated</strong> browser. Please
<a href="http://browsehappy.com/">upgrade your browser</a> to improve
your experience.
</p>
<![endif]-->
</body>
</html>

View File

@ -0,0 +1,27 @@
from boardgames.bgg import (
take_first,
lookup_boardgame_id_from_bgg,
lookup_boardgame_from_bgg,
)
def test_take_first():
assert take_first([]) == ""
assert take_first(["a", "b"]) == "a"
def test_lookup_boardgame_id_from_bgg():
bgg_id = lookup_boardgame_id_from_bgg("Cosmic Encounter")
assert bgg_id == "15"
bgg_id = lookup_boardgame_id_from_bgg("Comedy Encounter")
assert bgg_id == None
def test_lookup_boardgame_from_bgg():
bgg_result = lookup_boardgame_from_bgg(15)
assert bgg_result.get("bggeek_id") == 15
bgg_result = lookup_boardgame_from_bgg("Cosmic Encounter")
assert bgg_result.get("bggeek_id") == "15"

View File

@ -0,0 +1,21 @@
import pytest
from vrobbler.apps.podcasts.scrapers import scrape_data_from_google_podcasts
expected_desc_snippet = (
"NPR's Up First is the news you need to start your day. "
)
expected_img_url = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcR1F0CfR24RR6sme531yIkCrnK4zzmo97jeualO5drVPKG6oCk"
expected_google_url = "https://podcasts.google.com/feed/aHR0cHM6Ly9mZWVkcy5ucHIub3JnLzUxMDMxOC9wb2RjYXN0LnhtbA"
@pytest.mark.skip("Google Podcasts is gone")
def test_get_not_allowed_from_mopidy():
query = "Up First"
result_dict = scrape_data_from_google_podcasts(query)
assert result_dict["title"] == query
assert expected_desc_snippet in result_dict["description"]
assert result_dict["image_url"] == expected_img_url
assert result_dict["producer"] == "NPR"
assert result_dict["google_url"] == expected_google_url

View File

View File

View File

@ -0,0 +1,171 @@
import json
import pytest
from django.contrib.auth import get_user_model
from rest_framework.authtoken.models import Token
from boardgames.models import BoardGame
from music.models import Track, Artist
from scrobbles.models import Scrobble
from people.models import Person
User = get_user_model()
@pytest.fixture
def boardgame_scrobble():
first = Person.objects.create(name="First Player")
second = Person.objects.create(name="Second Player")
return Scrobble.objects.create(
board_game=BoardGame.objects.create(title="Test Board Game"),
media_type="BoardGame",
played_to_completion=True,
log={
"players": [
{"person_id": first.id, "win": True, "score": 30, "color": "Blue"},
{"person_id": second.id, "win": False, "score": 28, "color": "Red"}
],
},
)
@pytest.fixture
def test_track():
Track.objects.create(
title="Emotion",
artist=Artist.objects.create(name="Carly Rae Jepsen"),
run_time_seconds=60,
)
class MopidyRequest:
name = "Same in the End"
artist = "Sublime"
album = "Sublime"
track_number = 4
run_time_ticks = 156604
run_time = 60
playback_time_ticks = 15045
musicbrainz_track_id = "54214d63-5adf-4909-87cd-c65c37a6d558"
musicbrainz_album_id = "03b864cd-7761-314c-a892-05a89ddff00d"
musicbrainz_artist_id = "95f5b748-d370-47fe-85bd-0af2dc450bc0"
mopidy_uri = "local:track:Sublime%20-%20Sublime/Disc%201%20-%2004%20-%20Same%20in%20the%20End.mp3" # noqa
status = "resumed"
def __init__(self, **kwargs):
self.request_data = {
"name": kwargs.get("name", self.name),
"artist": kwargs.get("artist", self.artist),
"album": kwargs.get("album", self.album),
"track_number": int(kwargs.get("track_number", self.track_number)),
"run_time_ticks": int(
kwargs.get("run_time_ticks", self.run_time_ticks)
),
"run_time": int(kwargs.get("run_time", self.run_time)),
"playback_time_ticks": int(
kwargs.get("playback_time_ticks", self.playback_time_ticks)
),
"musicbrainz_track_id": kwargs.get(
"musicbrainz_track_id", self.musicbrainz_track_id
),
"musicbrainz_album_id": kwargs.get(
"musicbrainz_album_id", self.musicbrainz_album_id
),
"musicbrainz_artist_id": kwargs.get(
"musicbrainz_artist_id", self.musicbrainz_artist_id
),
"mopidy_uri": kwargs.get("mopidy_uri", self.mopidy_uri),
"status": kwargs.get("status", self.status),
}
def __eq__(self, other):
for key in self.request_data.keys():
if self.request_data[key] != getattr(self, key):
return False
return True
@property
def request_json(self):
return json.dumps(self.request_data)
@pytest.fixture
def valid_auth_token():
user = User.objects.create(email="test@exmaple.com")
return Token.objects.create(user=user).key
@pytest.fixture
def mopidy_track():
return MopidyRequest()
@pytest.fixture
def mopidy_track_diff_album_request_data(**kwargs):
mb_album_id = "0c56c457-afe1-4679-baab-759ba8dd2a58"
return MopidyRequest(
album="Gold", musicbrainz_album_id=mb_album_id
).request_json
@pytest.fixture
def mopidy_podcast_request_data():
mopidy_uri = "local:podcast:Up%20First/2022-01-01%20Up%20First.mp3"
return MopidyRequest(
mopidy_uri=mopidy_uri, artist="NPR", album="Up First"
).request_json
class JellyfinTrackRequest:
name = "Emotion"
artist = "Carly Rae Jepsen"
album = "Emotion"
track_number = 1
item_type = "Audio"
timestamp = "2024-01-14 12:00:19"
run_time_ticks = 156604
run_time = "00:00:60"
playback_time_ticks = 15045
musicbrainz_track_id = "54214d63-5adf-4909-87cd-c65c37a6d558"
musicbrainz_album_id = "03b864cd-7761-314c-a892-05a89ddff00d"
musicbrainz_artist_id = "95f5b748-d370-47fe-85bd-0af2dc450bc0"
status = "resumed"
def __init__(self, **kwargs):
self.request_data = {
"Name": kwargs.get("name", self.name),
"Artist": kwargs.get("artist", self.artist),
"Album": kwargs.get("album", self.album),
"TrackNumber": int(kwargs.get("track_number", self.track_number)),
"RunTime": kwargs.get("run_time", self.run_time),
"ItemType": kwargs.get("item_type", self.item_type),
"UtcTimestamp": kwargs.get("timestamp", self.timestamp),
"PlaybackPositionTicks": int(
kwargs.get("playback_time_ticks", self.playback_time_ticks)
),
"Provider_musicbrainztrack": kwargs.get(
"musicbrainz_track_id", self.musicbrainz_track_id
),
"Provider_musicbrainzalbum": kwargs.get(
"musicbrainz_album_id", self.musicbrainz_album_id
),
"Provider_musicbrainzartist": kwargs.get(
"musicbrainz_artist_id", self.musicbrainz_artist_id
),
"Status": kwargs.get("status", self.status),
}
def __eq__(self, other):
for key in self.request_data.keys():
if self.request_data[key] != getattr(self, key):
return False
return True
@property
def request_json(self):
return json.dumps(self.request_data)
@pytest.fixture
def jellyfin_track():
return JellyfinTrackRequest()

View File

@ -0,0 +1,71 @@
from datetime import datetime, timedelta
import pytest
import time_machine
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.utils import timezone
from music.aggregators import live_charts, scrobble_counts, week_of_scrobbles
from music.models import Album, Artist
from profiles.models import UserProfile
from scrobbles.models import Scrobble
def build_scrobbles(client, request_json, num=7, spacing=2):
url = reverse("scrobbles:mopidy-webhook")
user = get_user_model().objects.create(username="Test User")
user.profile.timezone = "US/Eastern"
user.profile.save()
for i in range(num):
client.post(url, request_json, content_type="application/json")
s = Scrobble.objects.last()
s.user = user
s.timestamp = timezone.now() - timedelta(days=i * spacing)
s.played_to_completion = True
s.save()
@pytest.mark.django_db
@time_machine.travel(datetime(2022, 3, 4, 1, 24))
def test_scrobble_counts_data(client, mopidy_track):
build_scrobbles(client, mopidy_track.request_json)
user = get_user_model().objects.first()
count_dict = scrobble_counts(user)
assert count_dict == {
"alltime": 7,
"month": 2,
"today": 1,
"week": 3,
"year": 7,
}
@pytest.mark.django_db
@time_machine.travel(datetime(2022, 3, 4, 1, 24))
def test_live_charts(client, mopidy_track):
build_scrobbles(client, mopidy_track.request_json, 7, 1)
user = get_user_model().objects.first()
week = week_of_scrobbles(user)
assert list(week.values()) == [1, 1, 1, 1, 1, 1, 1]
tops = live_charts(user)
assert tops[0].title == "Same in the End"
tops = live_charts(user, chart_period="week")
assert tops[0].title == "Same in the End"
tops = live_charts(user, chart_period="month")
assert tops[0].title == "Same in the End"
tops = live_charts(user, chart_period="year")
assert tops[0].title == "Same in the End"
tops = live_charts(user, chart_period="week", media_type="Artist")
assert tops[0].name == "Sublime"
tops = live_charts(user, chart_period="month", media_type="Artist")
assert tops[0].name == "Sublime"
tops = live_charts(user, chart_period="year", media_type="Artist")
assert tops[0].name == "Sublime"

View File

@ -0,0 +1,44 @@
import pytest
#from scrobbles.dataclasses import BoardGameLogData, BoardGameScoreLogData
@pytest.mark.skip("Need to get local tests running working again")
@pytest.mark.django_db
def test_boardgame_log_data(boardgame_scrobble):
assert boardgame_scrobble.logdata == BoardGameLogData(
players=[
BoardGameScoreLogData(
person_id=1,
bgg_username="",
color="Blue",
character=None,
team=None,
score=30,
win=True,
new=None,
rank=None,
seat_order=None,
role=None
),
BoardGameScoreLogData(
person_id=2,
bgg_username="",
color="Red",
character=None,
team=None,
score=28,
win=False,
new=None,
rank=None,
seat_order=None,
role=None
),
],
difficulty=None,
solo=None,
two_handed=None,
)
assert len(boardgame_scrobble.logdata.players) == 1
assert boardgame_scrobble.logdata.players[0].user.id == 1
assert boardgame_scrobble.logdata.players[0].name == "Test"

View File

@ -0,0 +1,12 @@
from datetime import datetime
import pytz
from django.contrib.auth import get_user_model
from vrobbler.apps.scrobbles.utils import timestamp_user_tz_to_utc
def test_timestamp_user_tz_to_utc():
timestamp = timestamp_user_tz_to_utc(
1685561082, pytz.timezone("US/Eastern")
)
assert timestamp == datetime(2023, 5, 31, 23, 24, 42, tzinfo=pytz.utc)

View File

@ -0,0 +1,252 @@
from datetime import datetime, timedelta
from unittest.mock import patch
from django.utils import timezone
import pytest
import time_machine
from django.urls import reverse
from music.models import Track
from podcasts.models import PodcastEpisode
from scrobbles.models import Scrobble
@pytest.mark.django_db
def test_get_not_allowed_from_mopidy(client, valid_auth_token):
url = reverse("scrobbles:mopidy-webhook")
headers = {"Authorization": f"Token {valid_auth_token}"}
response = client.get(url, headers=headers)
assert response.status_code == 405
@pytest.mark.django_db
def test_bad_mopidy_request_data(client, valid_auth_token):
url = reverse("scrobbles:mopidy-webhook")
headers = {"Authorization": f"Token {valid_auth_token}"}
response = client.post(url, headers)
assert response.status_code == 400
assert (
response.data["detail"]
== "JSON parse error - Expecting value: line 1 column 1 (char 0)"
)
@pytest.mark.skip("Need to refactor")
@pytest.mark.django_db
@patch("music.utils.lookup_artist_from_mb", return_value={})
@patch(
"music.utils.lookup_album_dict_from_mb",
return_value={"year": "1999", "mb_group_id": 1},
)
@patch("music.utils.lookup_track_from_mb", return_value={})
@patch("music.models.lookup_artist_from_tadb", return_value={})
@patch("music.models.lookup_album_from_tadb", return_value={"year": "1999"})
@patch("music.models.Album.fetch_artwork", return_value=None)
@patch("music.models.Album.scrape_allmusic", return_value=None)
def test_scrobble_mopidy_same_track_different_album(
mock_lookup_artist,
mock_lookup_album,
mock_lookup_track,
mock_lookup_artist_tadb,
mock_lookup_album_tadb,
mock_fetch_artwork,
mock_scrape_allmusic,
client,
mopidy_track,
mopidy_track_diff_album_request_data,
valid_auth_token,
):
url = reverse("scrobbles:mopidy-webhook")
headers = {"Authorization": f"Token {valid_auth_token}"}
response = client.post(
url,
mopidy_track.request_data,
content_type="application/json",
headers=headers,
)
assert response.status_code == 200
assert response.data == {"scrobble_id": 1}
scrobble = Scrobble.objects.last()
assert scrobble.media_obj.album.name == "Sublime"
response = client.post(
url,
mopidy_track_diff_album_request_data,
content_type="application/json",
)
assert response.status_code == 200
assert response.data == {"scrobble_id": 2}
scrobble = Scrobble.objects.last()
assert scrobble.media_obj.__class__ == Track
assert scrobble.media_obj.album.name == "Sublime"
assert scrobble.media_obj.title == "Same in the End"
@pytest.mark.django_db
@patch(
"podcasts.sources.podcastindex.lookup_podcast_from_podcastindex",
return_value={},
)
def test_scrobble_mopidy_podcast(
mock_lookup_podcast, client, mopidy_podcast_request_data, valid_auth_token
):
url = reverse("scrobbles:mopidy-webhook")
headers = {"Authorization": f"Token {valid_auth_token}"}
response = client.post(
url,
mopidy_podcast_request_data,
content_type="application/json",
headers=headers,
)
assert response.status_code == 200
assert response.data == {"scrobble_id": 1}
scrobble = Scrobble.objects.get(id=1)
assert scrobble.media_obj.__class__ == PodcastEpisode
assert scrobble.media_obj.title == "Up First"
@pytest.mark.skip("Need to refactor")
@pytest.mark.django_db
@patch("music.utils.lookup_artist_from_mb", return_value={})
@patch(
"music.utils.lookup_album_dict_from_mb",
return_value={"year": "1999", "mb_group_id": 1},
)
@patch("music.utils.lookup_track_from_mb", return_value={})
@patch("music.models.lookup_artist_from_tadb", return_value={})
@patch("music.models.lookup_album_from_tadb", return_value={"year": "1999"})
@patch("music.models.Album.fetch_artwork", return_value=None)
@patch("music.models.Album.scrape_allmusic", return_value=None)
def test_scrobble_jellyfin_track(
mock_lookup_artist,
mock_lookup_album,
mock_lookup_track,
mock_lookup_artist_tadb,
mock_lookup_album_tadb,
mock_fetch_artwork,
mock_scrape_allmusic,
client,
jellyfin_track,
valid_auth_token,
):
url = reverse("scrobbles:jellyfin-webhook")
headers = {"Authorization": f"Token {valid_auth_token}"}
with time_machine.travel(datetime(2024, 1, 14, 12, 00, 1)):
jellyfin_track.request_data["UtcTimestamp"] = timezone.now().strftime(
"%Y-%m-%d %H:%M:%S"
)
response = client.post(
url,
jellyfin_track.request_json,
content_type="application/json",
headers=headers,
)
assert response.status_code == 200
assert response.data == {"scrobble_id": 1}
scrobble = Scrobble.objects.get(id=1)
assert scrobble.media_obj.__class__ == Track
assert scrobble.media_obj.title == "Emotion"
@pytest.mark.skip("Need to refactor")
@pytest.mark.django_db
@patch("music.utils.lookup_artist_from_mb", return_value={})
@patch(
"music.utils.lookup_album_dict_from_mb",
return_value={"year": "1999", "mb_group_id": 1},
)
@patch("music.utils.lookup_track_from_mb", return_value={})
@patch("music.models.lookup_artist_from_tadb", return_value={})
@patch("music.models.lookup_album_from_tadb", return_value={"year": "1999"})
@patch("music.models.Album.fetch_artwork", return_value=None)
@patch("music.models.Album.scrape_allmusic", return_value=None)
def test_scrobble_jellyfin_track_update(
mock_lookup_artist,
mock_lookup_album,
mock_lookup_track,
mock_lookup_artist_tadb,
mock_lookup_album_tadb,
mock_fetch_artwork,
mock_scrape_allmusic,
test_track,
client,
jellyfin_track,
valid_auth_token,
):
Scrobble.objects.create(
timestamp=timezone.now() - timedelta(minutes=0.5),
track=Track.objects.first(),
user_id=1,
)
url = reverse("scrobbles:jellyfin-webhook")
headers = {"Authorization": f"Token {valid_auth_token}"}
jellyfin_track.request_data["UtcTimestamp"] = timezone.now().strftime(
"%Y-%m-%d %H:%M:%S"
)
response = client.post(
url,
jellyfin_track.request_json,
content_type="application/json",
headers=headers,
)
assert response.status_code == 200
assert response.data == {"scrobble_id": 1}
scrobble = Scrobble.objects.get(id=1)
assert scrobble.media_obj.__class__ == Track
assert scrobble.media_obj.title == "Emotion"
@pytest.mark.skip("Need to refactor")
@pytest.mark.django_db
@patch("music.utils.lookup_artist_from_mb", return_value={})
@patch(
"music.utils.lookup_album_dict_from_mb",
return_value={"year": "1999", "mb_group_id": 1},
)
@patch("music.utils.lookup_track_from_mb", return_value={})
@patch("music.models.lookup_artist_from_tadb", return_value={})
@patch("music.models.lookup_album_from_tadb", return_value={"year": "1999"})
@patch("music.models.Album.fetch_artwork", return_value=None)
@patch("music.models.Album.scrape_allmusic", return_value=None)
def test_scrobble_jellyfin_track_create_new(
mock_lookup_artist,
mock_lookup_album,
mock_lookup_track,
mock_lookup_artist_tadb,
mock_lookup_album_tadb,
mock_fetch_artwork,
mock_scrape_allmusic,
test_track,
client,
jellyfin_track,
valid_auth_token,
):
url = reverse("scrobbles:jellyfin-webhook")
headers = {"Authorization": f"Token {valid_auth_token}"}
Scrobble.objects.create(
timestamp=timezone.now() - timedelta(minutes=1),
track=Track.objects.first(),
user_id=1,
)
jellyfin_track.request_data["UtcTimestamp"] = timezone.now().strftime(
"%Y-%m-%d %H:%M:%S"
)
response = client.post(
url,
jellyfin_track.request_json,
content_type="application/json",
headers=headers,
)
assert response.status_code == 200
assert response.data == {"scrobble_id": 2}
scrobble = Scrobble.objects.get(id=1)
assert scrobble.media_obj.__class__ == Track
assert scrobble.media_obj.title == "Emotion"

View File

View File

@ -0,0 +1,6 @@
from videos.sources.imdb import lookup_video_from_imdb
def test_lookup_imdb():
metadata = lookup_video_from_imdb("8946378")
assert metadata.title == "Knives Out"

View File

@ -0,0 +1,9 @@
import pytest
from videos.sources.youtube import lookup_video_from_youtube
@pytest.mark.skip(reason="Need to configure Youtube API stuffs in CI")
@pytest.mark.django_db
def test_lookup_youtube_id():
metadata = lookup_video_from_youtube("RZxs9pAv99Y")
assert metadata.title == "No Pun Included's Board Game of the Year 2024"

View File

@ -1,11 +1,31 @@
# You can use this file to set environment variables for your local setup
#
VROBBLER_DEBUG=True
VROBBLER_JSON_LOGGING=True
VROBBLER_LOG_LEVEL="DEBUG"
VROBBLER_JSON_LOGGING=True
VROBBLER_MEDIA_ROOT = "/media/"
VROBBLER_TMDB_API_KEY = "KEY"
VROBBLER_KEEP_DETAILED_SCROBBLE_LOGS=True
VROBBLER_KEEP_DETAILED_SCROBBLE_LOGS=False
VROBBLER_DATABASE_URL="postgres://USER:PASSWORD@HOST:PORT/NAME"
VROBBLER_REDIS_URL="redis://:PASS@HOST:6379/0"
VROBBLER_USE_S3=False
# You may also need to set these in your environment
AWS_S3_ACCESS_KEY_ID=""
AWS_S3_SECRET_ACCESS_KEY=""
AWS_S3_CUSTOM_DOMAIN="https://minio.dev/"
# API keys
VROBBLER_TMDB_API_KEY = "<key>"
VROBBLER_LASTFM_API_KEY = "<key>"
VROBBLER_LASTFM_SECRET_KEY = "<key>"
VROBBLER_THESPORTSDB_API_KEY="<key>"
VROBBLER_THEAUDIODB_API_KEY="<key>"
VROBBLER_IGDB_CLIENT_ID="<id>"
VROBBLER_IGDB_CLIENT_SECRET="<key>"
VROBBLER_COMICVINE_API_KEY="<key>"
VROBBLER_TODOIST_CLIENT_ID="<id>"
VROBBLER_TODOIST_CLIENT_SECRET="<key>"
VROBBLER_GOOGLE_API_KEY="<key>"
VROBBLER_LICHESS_API_KEY = "<key>"
# Storages
# VROBBLER_DATABASE_URL="postgres://USER:PASSWORD@HOST:PORT/NAME"
# VROBBLER_REDIS_URL="redis://:PASS@HOST:6379/0"

11
vrobbler.conf.test Normal file
View File

@ -0,0 +1,11 @@
# Local configuration for Emus
VROBBLER_DUMP_REQUEST_DATA=False
VROBBLER_LOG_TO_CONSOLE=False
VROBBLER_DEBUG=False
VROBBLER_LOG_LEVEL="DEBUG"
VROBBLER_MEDIA_ROOT = "/tmp/media/"
VROBBLER_KEEP_DETAILED_SCROBBLE_LOGS=False
VROBBLER_USE_S3="False"
VROBBLER_DATABASE_URL="sqlite:///testdb.sqlite3"

View File

@ -0,0 +1,5 @@
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app
__all__ = ("celery_app",)

View File

@ -0,0 +1,34 @@
from beers.models import Beer, BeerProducer, BeerStyle
from django.contrib import admin
from scrobbles.admin import ScrobbleInline
class BeerInline(admin.TabularInline):
model = Beer
extra = 0
@admin.register(BeerStyle)
class BeerStyle(admin.ModelAdmin):
date_hierarchy = "created"
search_fields = ("name",)
@admin.register(BeerProducer)
class BeerProducer(admin.ModelAdmin):
date_hierarchy = "created"
search_fields = ("name",)
@admin.register(Beer)
class BeerAdmin(admin.ModelAdmin):
date_hierarchy = "created"
list_display = (
"uuid",
"title",
)
ordering = ("-created",)
search_fields = ("title",)
inlines = [
ScrobbleInline,
]

View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class BeersConfig(AppConfig):
name = "beers"

View File

@ -0,0 +1,133 @@
# Generated by Django 4.2.16 on 2024-10-22 21:26
from django.db import migrations, models
import django_extensions.db.fields
import taggit.managers
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
("scrobbles", "0065_alter_scrobble_log"),
]
operations = [
migrations.CreateModel(
name="BeerProducer",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created",
django_extensions.db.fields.CreationDateTimeField(
auto_now_add=True, verbose_name="created"
),
),
(
"modified",
django_extensions.db.fields.ModificationDateTimeField(
auto_now=True, verbose_name="modified"
),
),
("description", models.TextField(blank=True, null=True)),
(
"location",
models.CharField(blank=True, max_length=255, null=True),
),
],
options={
"get_latest_by": "modified",
"abstract": False,
},
),
migrations.CreateModel(
name="Beer",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created",
django_extensions.db.fields.CreationDateTimeField(
auto_now_add=True, verbose_name="created"
),
),
(
"modified",
django_extensions.db.fields.ModificationDateTimeField(
auto_now=True, verbose_name="modified"
),
),
(
"uuid",
models.UUIDField(
blank=True,
default=uuid.uuid4,
editable=False,
null=True,
),
),
(
"title",
models.CharField(blank=True, max_length=255, null=True),
),
(
"run_time_seconds",
models.IntegerField(blank=True, null=True),
),
(
"run_time_ticks",
models.PositiveBigIntegerField(blank=True, null=True),
),
("description", models.TextField(blank=True, null=True)),
("ibu", models.SmallIntegerField(blank=True, null=True)),
("abv", models.FloatField(blank=True, null=True)),
(
"style",
models.CharField(blank=True, max_length=100, null=True),
),
("non_alcoholic", models.BooleanField(default=False)),
(
"beeradvocate_id",
models.CharField(blank=True, max_length=255, null=True),
),
(
"beeradvocate_score",
models.SmallIntegerField(blank=True, null=True),
),
(
"untappd_id",
models.CharField(blank=True, max_length=255, null=True),
),
(
"genre",
taggit.managers.TaggableManager(
blank=True,
help_text="A comma-separated list of tags.",
through="scrobbles.ObjectWithGenres",
to="scrobbles.Genre",
verbose_name="Tags",
),
),
],
options={
"abstract": False,
},
),
]

View File

@ -0,0 +1,36 @@
# Generated by Django 4.2.16 on 2024-10-22 21:34
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("beers", "0001_initial"),
]
operations = [
migrations.AddField(
model_name="beer",
name="beeradvocate_image",
field=models.ImageField(
blank=True, null=True, upload_to="beers/beeradvcoate/"
),
),
migrations.AddField(
model_name="beer",
name="producer",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
to="beers.beerproducer",
),
),
migrations.AddField(
model_name="beerproducer",
name="beeradvocate_id",
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View File

@ -0,0 +1,75 @@
# Generated by Django 4.2.16 on 2024-10-22 21:47
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
("beers", "0002_beer_beeradvocate_image_beer_producer_and_more"),
]
operations = [
migrations.CreateModel(
name="BeerStyle",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created",
django_extensions.db.fields.CreationDateTimeField(
auto_now_add=True, verbose_name="created"
),
),
(
"modified",
django_extensions.db.fields.ModificationDateTimeField(
auto_now=True, verbose_name="modified"
),
),
("description", models.TextField(blank=True, null=True)),
],
options={
"get_latest_by": "modified",
"abstract": False,
},
),
migrations.RemoveField(
model_name="beer",
name="beeradvocate_image",
),
migrations.RemoveField(
model_name="beer",
name="style",
),
migrations.AddField(
model_name="beer",
name="untappd_image",
field=models.ImageField(
blank=True, null=True, upload_to="beers/untappd/"
),
),
migrations.AddField(
model_name="beer",
name="untappd_rating",
field=models.FloatField(blank=True, null=True),
),
migrations.AddField(
model_name="beerproducer",
name="untappd_id",
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name="beer",
name="styles",
field=models.ManyToManyField(to="beers.beerstyle"),
),
]

View File

@ -0,0 +1,47 @@
# Generated by Django 4.2.16 on 2024-10-22 21:52
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
("beers", "0003_beerstyle_remove_beer_beeradvocate_image_and_more"),
]
operations = [
migrations.AddField(
model_name="beerproducer",
name="name",
field=models.CharField(default="Untitled", max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name="beerproducer",
name="uuid",
field=models.UUIDField(
blank=True, default=uuid.uuid4, editable=False, null=True
),
),
migrations.AddField(
model_name="beerstyle",
name="name",
field=models.CharField(default="Untitled", max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name="beerstyle",
name="uuid",
field=models.UUIDField(
blank=True, default=uuid.uuid4, editable=False, null=True
),
),
migrations.AlterField(
model_name="beer",
name="styles",
field=models.ManyToManyField(
related_name="styles", to="beers.beerstyle"
),
),
]

View File

@ -0,0 +1,21 @@
# Generated by Django 4.2.16 on 2025-01-22 03:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
(
"beers",
"0004_beerproducer_name_beerproducer_uuid_beerstyle_name_and_more",
),
]
operations = [
migrations.AlterField(
model_name="beer",
name="run_time_seconds",
field=models.IntegerField(default=900),
),
]

View File

@ -0,0 +1,147 @@
from dataclasses import dataclass
from typing import Optional
from uuid import uuid4
from beers.untappd import get_beer_from_untappd_id
from django.apps import apps
from django.db import models
from django.urls import reverse
from django_extensions.db.models import TimeStampedModel
from imagekit.models import ImageSpecField
from imagekit.processors import ResizeToFit
from scrobbles.dataclasses import BaseLogData
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
BNULL = {"blank": True, "null": True}
@dataclass
class BeerLogData(BaseLogData):
rating: Optional[str] = None
class BeerStyle(TimeStampedModel):
uuid = models.UUIDField(default=uuid4, editable=False, **BNULL)
name = models.CharField(max_length=255)
description = models.TextField(**BNULL)
def __str__(self):
return self.name
class BeerProducer(TimeStampedModel):
uuid = models.UUIDField(default=uuid4, editable=False, **BNULL)
name = models.CharField(max_length=255)
description = models.TextField(**BNULL)
location = models.CharField(max_length=255, **BNULL)
beeradvocate_id = models.CharField(max_length=255, **BNULL)
untappd_id = models.CharField(max_length=255, **BNULL)
def find_or_create(cls, title: str) -> "BeerProducer":
return cls.objects.filter(title=title).first()
def __str__(self):
return self.name
class Beer(ScrobblableMixin):
description = models.TextField(**BNULL)
ibu = models.SmallIntegerField(**BNULL)
abv = models.FloatField(**BNULL)
styles = models.ManyToManyField(BeerStyle, related_name="styles")
non_alcoholic = models.BooleanField(default=False)
beeradvocate_id = models.CharField(max_length=255, **BNULL)
beeradvocate_score = models.SmallIntegerField(**BNULL)
untappd_image = models.ImageField(upload_to="beers/untappd/", **BNULL)
untappd_image_small = ImageSpecField(
source="untappd_image",
processors=[ResizeToFit(100, 100)],
format="JPEG",
options={"quality": 60},
)
untappd_image_medium = ImageSpecField(
source="untappd_image",
processors=[ResizeToFit(300, 300)],
format="JPEG",
options={"quality": 75},
)
untappd_id = models.CharField(max_length=255, **BNULL)
untappd_rating = models.FloatField(**BNULL)
producer = models.ForeignKey(
BeerProducer, on_delete=models.DO_NOTHING, **BNULL
)
def get_absolute_url(self) -> str:
return reverse("beers:beer_detail", kwargs={"slug": self.uuid})
def __str__(self):
return f"{self.title} by {self.producer}"
@property
def subtitle(self):
return self.producer.name
@property
def strings(self) -> ScrobblableConstants:
return ScrobblableConstants(verb="Drinking", tags="beer")
@property
def beeradvocate_link(self) -> str:
link = ""
if self.producer and self.beeradvocate_id:
if self.beeradvocate_id:
link = f"https://www.beeradvocate.com/beer/profile/{self.producer.beeradvocate_id}/{self.beeradvocate_id}/"
return link
@property
def untappd_link(self) -> str:
link = ""
if self.untappd_id:
link = f"https://www.untappd.com/beer/{self.untappd_id}/"
return link
@property
def primary_image_url(self) -> str:
url = ""
if self.untappd_image:
url = self.untappd_image.url
return url
@property
def logdata_cls(self):
return BeerLogData
@classmethod
def find_or_create(cls, untappd_id: str) -> "Beer":
beer = cls.objects.filter(untappd_id=untappd_id).first()
if not beer:
beer_dict = get_beer_from_untappd_id(untappd_id)
producer_dict = {}
style_ids = []
for key in list(beer_dict.keys()):
if "producer__" in key:
pkey = key.replace("producer__", "")
producer_dict[pkey] = beer_dict.pop(key)
if "styles" in key:
for style in beer_dict.pop("styles"):
style_inst, created = BeerStyle.objects.get_or_create(
name=style
)
style_ids.append(style_inst.id)
producer, _created = BeerProducer.objects.get_or_create(
**producer_dict
)
beer_dict["producer_id"] = producer.id
beer = Beer.objects.create(**beer_dict)
for style_id in style_ids:
beer.styles.add(style_id)
return beer
def scrobbles(self, user_id):
Scrobble = apps.get_model("scrobbles", "Scrobble")
return Scrobble.objects.filter(user_id=user_id, beer=self).order_by(
"-timestamp"
)

View File

@ -0,0 +1,142 @@
import logging
from typing import Optional
import requests
from bs4 import BeautifulSoup
logger = logging.getLogger(__name__)
UNTAPPD_URL = "https://untappd.com/beer/{id}"
def get_first(key: str, result: dict) -> str:
obj = ""
if obj_list := result.get(key):
obj = obj_list[0]
return obj
def get_title_from_soup(soup) -> str:
title = ""
try:
title = soup.find("h1").get_text()
except AttributeError:
pass
except ValueError:
pass
return title
def get_description_from_soup(soup) -> str:
desc = ""
try:
desc = (
soup.find(class_="beer-descrption-read-less")
.get_text()
.replace("Show Less", "")
.strip()
)
except AttributeError:
pass
except ValueError:
pass
return desc
def get_styles_from_soup(soup) -> list[str]:
styles = []
try:
styles = soup.find("p", class_="style").get_text().split(" - ")
except AttributeError:
pass
except ValueError:
pass
return styles
def get_abv_from_soup(soup) -> Optional[float]:
abv = None
try:
abv = soup.find(class_="abv").get_text()
if abv:
abv = float(abv.strip("\n").strip("% ABV").strip())
except AttributeError:
pass
except ValueError:
pass
except TypeError:
pass
return abv
def get_ibu_from_soup(soup) -> Optional[int]:
ibu = None
try:
ibu = soup.find(class_="ibu").get_text()
if ibu:
ibu = int(ibu.strip("\n").strip(" IBU").strip())
except AttributeError:
pass
except ValueError:
ibu = None
return ibu
def get_rating_from_soup(soup) -> str:
rating = ""
try:
rating = float(
soup.find(class_="num").get_text().strip("(").strip(")")
)
except AttributeError:
rating = None
except ValueError:
rating = None
return rating
def get_producer_id_from_soup(soup) -> str:
id = ""
try:
id = soup.find(class_="brewery").find("a")["href"].strip("/")
except ValueError:
pass
except IndexError:
pass
return id
def get_producer_name_from_soup(soup) -> str:
name = ""
try:
name = soup.find(class_="brewery").find("a").get_text()
except AttributeError:
pass
except ValueError:
pass
return name
def get_beer_from_untappd_id(untappd_id: str) -> dict:
beer_url = UNTAPPD_URL.format(id=untappd_id)
headers = {"User-Agent": "Vrobbler 0.11.12"}
response = requests.get(beer_url, headers=headers)
beer_dict = {"untappd_id": untappd_id}
if response.status_code != 200:
logger.warn(
"Bad response from untappd.com", extra={"response": response}
)
return beer_dict
soup = BeautifulSoup(response.text, "html.parser")
beer_dict["title"] = get_title_from_soup(soup)
beer_dict["description"] = get_description_from_soup(soup)
beer_dict["styles"] = get_styles_from_soup(soup)
beer_dict["abv"] = get_abv_from_soup(soup)
beer_dict["ibu"] = get_ibu_from_soup(soup)
beer_dict["untappd_rating"] = get_rating_from_soup(soup)
beer_dict["producer__untappd_id"] = get_producer_id_from_soup(soup)
beer_dict["producer__name"] = get_producer_name_from_soup(soup)
return beer_dict

View File

@ -0,0 +1,14 @@
from django.urls import path
from beers import views
app_name = "beers"
urlpatterns = [
path("beers/", views.BeerListView.as_view(), name="beer_list"),
path(
"beers/<slug:slug>/",
views.BeerDetailView.as_view(),
name="beer_detail",
),
]

View File

@ -0,0 +1,11 @@
from beers.models import Beer
from scrobbles.views import ScrobbleableListView, ScrobbleableDetailView
class BeerListView(ScrobbleableListView):
model = Beer
class BeerDetailView(ScrobbleableDetailView):
model = Beer

View File

@ -0,0 +1,56 @@
from django.contrib import admin
from boardgames.models import (
BoardGame,
BoardGameLocation,
BoardGamePublisher,
BoardGameDesigner,
)
from scrobbles.admin import ScrobbleInline
@admin.register(BoardGamePublisher)
class BoardGamePublisherAdmin(admin.ModelAdmin):
date_hierarchy = "created"
list_display = (
"name",
"uuid",
)
ordering = ("-created",)
@admin.register(BoardGameDesigner)
class BoardGameDesignerAdmin(admin.ModelAdmin):
date_hierarchy = "created"
list_display = (
"name",
"uuid",
)
ordering = ("-created",)
@admin.register(BoardGameLocation)
class BoardGameLocationAdmin(admin.ModelAdmin):
date_hierarchy = "created"
list_display = (
"name",
"uuid",
"geo_location",
)
ordering = ("-created",)
@admin.register(BoardGame)
class BoardGameAdmin(admin.ModelAdmin):
date_hierarchy = "created"
list_display = (
"bggeek_id",
"title",
"published_year",
)
search_fields = ("title",)
ordering = ("-created",)
inlines = [
ScrobbleInline,
]

View File

@ -0,0 +1,153 @@
import csv
import json
import logging
from typing import TYPE_CHECKING, Optional
import requests
from bs4 import BeautifulSoup
from django.contrib.auth import get_user_model
User = get_user_model()
if TYPE_CHECKING:
from scrobbles.models import Scrobble
logger = logging.getLogger(__name__)
SEARCH_ID_URL = (
"https://boardgamegeek.com/xmlapi/search?search={query}&exact=1"
)
GAME_ID_URL = "https://boardgamegeek.com/xmlapi/boardgame/{id}"
def take_first(thing: Optional[list]) -> str:
first = ""
try:
first = thing[0]
except IndexError:
pass
if first:
try:
first = first.get_text()
except:
pass
return first
def lookup_boardgame_id_from_bgg(title: str) -> Optional[int]:
soup = None
headers = {"User-Agent": "Vrobbler 0.11.12"}
game_id = None
url = SEARCH_ID_URL.format(query=title)
r = requests.get(url, headers=headers)
if r.status_code == 200:
soup = BeautifulSoup(r.text, "xml")
if soup:
result = soup.findAll("boardgame")
if not result:
return game_id
game_id = result[0].get("objectid", None)
return game_id
def lookup_boardgame_from_bgg(lookup_id: str) -> dict:
soup = None
game_dict = {}
headers = {"User-Agent": "Vrobbler 0.11.12"}
title = ""
bgg_id = None
try:
bgg_id = int(lookup_id)
logger.debug(f"Using BGG ID {bgg_id} to find board game")
except ValueError:
title = lookup_id
logger.debug(f"Using title {title} to find board game")
if not bgg_id:
bgg_id = lookup_boardgame_id_from_bgg(title)
url = GAME_ID_URL.format(id=bgg_id)
r = requests.get(url, headers=headers)
if r.status_code == 200:
soup = BeautifulSoup(r.text, "xml")
if soup:
seconds_to_play = None
minutes = take_first(soup.findAll("playingtime"))
if minutes:
seconds_to_play = int(minutes) * 60
game_dict = {
"bggeek_id": bgg_id,
"title": take_first(soup.findAll("name", primary="true")),
"description": take_first(soup.findAll("description")),
"year_published": take_first(soup.findAll("yearpublished")),
"publisher_name": take_first(soup.findAll("boardgamepublisher")),
"cover_url": take_first(soup.findAll("image")),
"min_players": take_first(soup.findAll("minplayers")),
"max_players": take_first(soup.findAll("maxplayers")),
"recommended_age": take_first(soup.findAll("age")),
"run_time_seconds": seconds_to_play,
}
return game_dict
def push_scrobble_to_bgg(scrobble: "Scrobble", user: User) -> Optional[bool]:
bgg_username = "secstate" # user.profile.bgg_username
bgg_password = "yYFCKnfo8AK89lc68q0S"
if not bgg_username or bgg_password:
return
login_payload = {
"credentials": {"username": bgg_username, "password": bgg_password}
}
headers = {"content-type": "application/json"}
# TODO Look up past plays for scrobble.media_obj.bggeek_id, and make sure we haven't scrobbled this before
with requests.Session() as s:
p = s.post(
"https://boardgamegeek.com/login/api/v1",
data=json.dumps(login_payload),
headers=headers,
)
players = []
if scrobble.log:
for player in scrobble.log.get("players"):
player_person = Person.objects.filter(
id=player.get("person_id")
).first()
if player_person.get("bgg_username"):
player["username"] = player_person.get("bgg_username")
player["name"] = player_person.get("name")
player["win"] = player.get("win")
# player["role"] = player.get("role")
player["new"] = player.get("new")
player["score"] = player.get("score")
players.append(player)
play_payload = {
"playdate": scrobble.timestamp.date.strftime("%Y-%m-%d"),
"length": scrobble.playback_position_seconds / 60,
"comments": "Uploaded from Vrobbler",
"location": scrobble.log.location or None,
"objectid": scrobble.media_obj.bggeek_id,
"quantity": "1",
"action": "save",
"players": players,
"objecttype": "thing",
"ajax": 1,
}
r = s.post(
"https://boardgamegeek.com/geekplay.php",
data=json.dumps(play_payload),
headers=headers,
)

View File

@ -0,0 +1,168 @@
# Generated by Django 4.1.7 on 2023-04-17 22:11
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
import taggit.managers
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
("scrobbles", "0038_alter_objectwithgenres_tag"),
]
operations = [
migrations.CreateModel(
name="BoardGamePublisher",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created",
django_extensions.db.fields.CreationDateTimeField(
auto_now_add=True, verbose_name="created"
),
),
(
"modified",
django_extensions.db.fields.ModificationDateTimeField(
auto_now=True, verbose_name="modified"
),
),
("name", models.CharField(max_length=255)),
(
"uuid",
models.UUIDField(
blank=True,
default=uuid.uuid4,
editable=False,
null=True,
),
),
(
"logo",
models.ImageField(
blank=True,
null=True,
upload_to="games/platform-logos/",
),
),
("igdb_id", models.IntegerField(blank=True, null=True)),
],
options={
"get_latest_by": "modified",
"abstract": False,
},
),
migrations.CreateModel(
name="BoardGame",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created",
django_extensions.db.fields.CreationDateTimeField(
auto_now_add=True, verbose_name="created"
),
),
(
"modified",
django_extensions.db.fields.ModificationDateTimeField(
auto_now=True, verbose_name="modified"
),
),
(
"run_time_seconds",
models.IntegerField(blank=True, null=True),
),
(
"run_time_ticks",
models.PositiveBigIntegerField(blank=True, null=True),
),
("title", models.CharField(max_length=255)),
(
"uuid",
models.UUIDField(
blank=True,
default=uuid.uuid4,
editable=False,
null=True,
),
),
(
"cover",
models.ImageField(
blank=True, null=True, upload_to="boardgames/covers/"
),
),
(
"layout_image",
models.ImageField(
blank=True, null=True, upload_to="boardgames/layouts/"
),
),
("summary", models.TextField(blank=True, null=True)),
("rating", models.FloatField(blank=True, null=True)),
(
"max_players",
models.PositiveSmallIntegerField(blank=True, null=True),
),
(
"min_players",
models.PositiveSmallIntegerField(blank=True, null=True),
),
("published_date", models.DateField(blank=True, null=True)),
(
"recommened_age",
models.PositiveSmallIntegerField(blank=True, null=True),
),
(
"seconds_to_play",
models.IntegerField(blank=True, null=True),
),
(
"bggeek_id",
models.CharField(blank=True, max_length=255, null=True),
),
(
"genre",
taggit.managers.TaggableManager(
help_text="A comma-separated list of tags.",
through="scrobbles.ObjectWithGenres",
to="scrobbles.Genre",
verbose_name="Tags",
),
),
(
"publisher",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
to="boardgames.boardgamepublisher",
),
),
],
options={
"abstract": False,
},
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.1.7 on 2023-04-17 22:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("boardgames", "0001_initial"),
]
operations = [
migrations.AddField(
model_name="boardgame",
name="description",
field=models.TextField(blank=True, null=True),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.1.7 on 2023-04-17 22:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("boardgames", "0002_boardgame_description"),
]
operations = [
migrations.RenameField(
model_name="boardgame",
old_name="recommened_age",
new_name="recommended_age",
),
]

View File

@ -0,0 +1,17 @@
# Generated by Django 4.1.7 on 2023-04-17 22:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("boardgames", "0003_rename_recommened_age_boardgame_recommended_age"),
]
operations = [
migrations.RemoveField(
model_name="boardgame",
name="seconds_to_play",
),
]

View File

@ -0,0 +1,17 @@
# Generated by Django 4.1.7 on 2023-04-17 22:29
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("boardgames", "0004_remove_boardgame_seconds_to_play"),
]
operations = [
migrations.RemoveField(
model_name="boardgame",
name="summary",
),
]

View File

@ -0,0 +1,26 @@
# Generated by Django 4.1.7 on 2023-04-18 02:33
from django.db import migrations
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
("scrobbles", "0040_alter_scrobble_media_type"),
("boardgames", "0005_remove_boardgame_summary"),
]
operations = [
migrations.AlterField(
model_name="boardgame",
name="genre",
field=taggit.managers.TaggableManager(
blank=True,
help_text="A comma-separated list of tags.",
through="scrobbles.ObjectWithGenres",
to="scrobbles.Genre",
verbose_name="Tags",
),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.2.16 on 2025-01-22 03:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("boardgames", "0006_alter_boardgame_genre"),
]
operations = [
migrations.AlterField(
model_name="boardgame",
name="run_time_seconds",
field=models.IntegerField(default=900),
),
]

View File

@ -0,0 +1,167 @@
# Generated by Django 4.2.19 on 2025-07-03 01:57
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
import uuid
class Migration(migrations.Migration):
dependencies = [
("locations", "0007_alter_geolocation_run_time_seconds"),
("boardgames", "0007_alter_boardgame_run_time_seconds"),
]
operations = [
migrations.CreateModel(
name="BoardGameDesigner",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created",
django_extensions.db.fields.CreationDateTimeField(
auto_now_add=True, verbose_name="created"
),
),
(
"modified",
django_extensions.db.fields.ModificationDateTimeField(
auto_now=True, verbose_name="modified"
),
),
("name", models.CharField(max_length=255)),
(
"uuid",
models.UUIDField(
blank=True,
default=uuid.uuid4,
editable=False,
null=True,
),
),
("bgg_id", models.IntegerField(blank=True, null=True)),
("bio", models.TextField(blank=True, null=True)),
],
options={
"get_latest_by": "modified",
"abstract": False,
},
),
migrations.RenameField(
model_name="boardgamepublisher",
old_name="igdb_id",
new_name="bgg_id",
),
migrations.AddField(
model_name="boardgame",
name="bgstats_id",
field=models.UUIDField(blank=True, null=True),
),
migrations.AddField(
model_name="boardgame",
name="cooperative",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="boardgame",
name="expansion_for_boardgame",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
to="boardgames.boardgame",
),
),
migrations.AddField(
model_name="boardgame",
name="highest_wins",
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name="boardgame",
name="max_play_time",
field=models.IntegerField(blank=True, null=True),
),
migrations.AddField(
model_name="boardgame",
name="min_play_time",
field=models.IntegerField(blank=True, null=True),
),
migrations.AddField(
model_name="boardgame",
name="no_points",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="boardgame",
name="uses_teams",
field=models.BooleanField(default=False),
),
migrations.CreateModel(
name="BoardGameLocation",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created",
django_extensions.db.fields.CreationDateTimeField(
auto_now_add=True, verbose_name="created"
),
),
(
"modified",
django_extensions.db.fields.ModificationDateTimeField(
auto_now=True, verbose_name="modified"
),
),
("name", models.CharField(max_length=255)),
(
"uuid",
models.UUIDField(
blank=True,
default=uuid.uuid4,
editable=False,
null=True,
),
),
("bgstats_id", models.UUIDField(blank=True, null=True)),
("description", models.TextField(blank=True, null=True)),
(
"geo_location",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
to="locations.geolocation",
),
),
],
options={
"get_latest_by": "modified",
"abstract": False,
},
),
migrations.AddField(
model_name="boardgame",
name="designers",
field=models.ManyToManyField(
related_name="board_games", to="boardgames.boardgamedesigner"
),
),
]

View File

@ -0,0 +1,33 @@
# Generated by Django 4.2.19 on 2025-07-03 02:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("boardgames", "0008_boardgamedesigner_and_more"),
]
operations = [
migrations.AlterField(
model_name="boardgame",
name="cooperative",
field=models.BooleanField(blank=True, default=False, null=True),
),
migrations.AlterField(
model_name="boardgame",
name="highest_wins",
field=models.BooleanField(blank=True, default=True, null=True),
),
migrations.AlterField(
model_name="boardgame",
name="no_points",
field=models.BooleanField(blank=True, default=False, null=True),
),
migrations.AlterField(
model_name="boardgame",
name="uses_teams",
field=models.BooleanField(blank=True, default=False, null=True),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.2.19 on 2025-07-03 04:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("boardgames", "0009_alter_boardgame_cooperative_and_more"),
]
operations = [
migrations.AddField(
model_name="boardgame",
name="published_year",
field=models.IntegerField(blank=True, null=True),
),
]

View File

@ -0,0 +1,329 @@
from functools import cached_property
import logging
from dataclasses import dataclass
from datetime import datetime
from typing import Optional
from uuid import uuid4
from django import forms
import requests
from boardgames.bgg import lookup_boardgame_from_bgg
from django.conf import settings
from django.core.files.base import ContentFile
from django.db import models
from django.urls import reverse
from django_extensions.db.models import TimeStampedModel
from imagekit.models import ImageSpecField
from imagekit.processors import ResizeToFit
from locations.models import GeoLocation
from people.models import Person
from scrobbles.dataclasses import BaseLogData, LongPlayLogData
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
logger = logging.getLogger(__name__)
BNULL = {"blank": True, "null": True}
@dataclass
class BoardGameScoreLogData(BaseLogData):
person_id: Optional[int] = None
bgg_username: Optional[str] = None
color: Optional[str] = None
character: Optional[str] = None
team: Optional[str] = None
score: Optional[int] = None
win: Optional[bool] = None
new: Optional[bool] = None
rank: Optional[int] = None
seat_order: Optional[int] = None
role: Optional[str] = None
rank: Optional[int] = None
seat_order: Optional[int] = None
role: Optional[str] = None
lichess_username: Optional[str] = None
@property
def person(self) -> Optional[Person]:
return Person.objects.filter(id=self.person_id).first()
@property
def name(self) -> str:
name = ""
if self.person:
name = self.person.name
return name
def __str__(self) -> str:
out = self.name
if self.score:
out += f" {self.score}"
if self.color:
out += f" ({self.color})"
if self.win:
out += f" [W]"
return out
@dataclass
class BoardGameLogData(BaseLogData, LongPlayLogData):
players: Optional[list[BoardGameScoreLogData]] = None
location_id: Optional[int] = None
difficulty: Optional[int] = None
solo: Optional[bool] = None
two_handed: Optional[bool] = None
expansion_ids: Optional[int] = None
moves: Optional[list] = None
rated: Optional[str] = None
speed: Optional[str] = None
variant: Optional[str] = None
lichess_id: Optional[int] = None
board: Optional[str] = None
rounds: Optional[int] = None
details: Optional[str] = None
_excluded_fields = {
"lichess_id",
"speed",
"rated",
"moves",
"variant",
}
@cached_property
def location(self):
if not self.location_id:
return
return BoardGameLocation.objects.filter(id=self.location_id).first()
@cached_property
def player_log(self) -> str:
if self.players:
return ", ".join(
[
BoardGameScoreLogData(**player).__str__()
for player in self.players
]
)
return ""
@classmethod
def override_fields(cls) -> dict:
fields = {}
for base in cls.mro()[1:]:
if hasattr(base, "override_fields"):
base_fields = base.override_fields()
fields.update(base_fields)
custom_fields = {
"location_id": forms.ModelChoiceField(
queryset=BoardGameLocation.objects.all(),
required=False,
widget=forms.Select(),
)
}
fields.update(custom_fields)
return fields
class BoardGamePublisher(TimeStampedModel):
name = models.CharField(max_length=255)
uuid = models.UUIDField(default=uuid4, editable=False, **BNULL)
logo = models.ImageField(upload_to="games/platform-logos/", **BNULL)
bgg_id = models.IntegerField(**BNULL)
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse(
"boardgames:publisher_detail", kwargs={"slug": self.uuid}
)
class BoardGameDesigner(TimeStampedModel):
name = models.CharField(max_length=255)
uuid = models.UUIDField(default=uuid4, editable=False, **BNULL)
bgg_id = models.IntegerField(**BNULL)
bio = models.TextField(**BNULL)
def __str__(self) -> str:
return str(self.name)
def get_absolute_url(self):
return reverse(
"boardgames:designer_detail", kwargs={"slug": self.uuid}
)
class BoardGameLocation(TimeStampedModel):
name = models.CharField(max_length=255)
uuid = models.UUIDField(default=uuid4, editable=False, **BNULL)
bgstats_id = models.UUIDField(**BNULL)
description = models.TextField(**BNULL)
geo_location = models.ForeignKey(
GeoLocation, **BNULL, on_delete=models.DO_NOTHING
)
def __str__(self) -> str:
return str(self.name)
def get_absolute_url(self):
return reverse(
"boardgames:location_detail", kwargs={"slug": self.uuid}
)
class BoardGame(ScrobblableMixin):
COMPLETION_PERCENT = getattr(
settings, "BOARD_GAME_COMPLETION_PERCENT", 100
)
FIELDS_FROM_BGGEEK = [
"igdb_id",
"alternative_name",
"rating",
"rating_count",
"release_date",
"cover",
"screenshot",
]
title = models.CharField(max_length=255)
publisher = models.ForeignKey(
BoardGamePublisher, **BNULL, on_delete=models.DO_NOTHING
)
designers = models.ManyToManyField(
BoardGameDesigner,
related_name="board_games",
)
uuid = models.UUIDField(default=uuid4, editable=False, **BNULL)
description = models.TextField(**BNULL)
cover = models.ImageField(upload_to="boardgames/covers/", **BNULL)
cover_small = ImageSpecField(
source="cover",
processors=[ResizeToFit(100, 100)],
format="JPEG",
options={"quality": 60},
)
cover_medium = ImageSpecField(
source="cover",
processors=[ResizeToFit(300, 300)],
format="JPEG",
options={"quality": 75},
)
layout_image = models.ImageField(upload_to="boardgames/layouts/", **BNULL)
layout_image_small = ImageSpecField(
source="layout_image",
processors=[ResizeToFit(100, 100)],
format="JPEG",
options={"quality": 60},
)
layout_image_medium = ImageSpecField(
source="layout_image",
processors=[ResizeToFit(300, 300)],
format="JPEG",
options={"quality": 75},
)
rating = models.FloatField(**BNULL)
max_players = models.PositiveSmallIntegerField(**BNULL)
min_players = models.PositiveSmallIntegerField(**BNULL)
published_date = models.DateField(**BNULL)
published_year = models.IntegerField(**BNULL)
recommended_age = models.PositiveSmallIntegerField(**BNULL)
bggeek_id = models.CharField(max_length=255, **BNULL)
bgstats_id = models.UUIDField(**BNULL)
uses_teams = models.BooleanField(default=False, **BNULL)
cooperative = models.BooleanField(default=False, **BNULL)
highest_wins = models.BooleanField(default=True, **BNULL)
no_points = models.BooleanField(default=False, **BNULL)
min_play_time = models.IntegerField(**BNULL)
max_play_time = models.IntegerField(**BNULL)
expansion_for_boardgame = models.ForeignKey(
"self", **BNULL, on_delete=models.DO_NOTHING
)
def __str__(self):
return self.title
def get_absolute_url(self):
return reverse(
"boardgames:boardgame_detail", kwargs={"slug": self.uuid}
)
@property
def logdata_cls(self):
return BoardGameLogData
@property
def strings(self) -> ScrobblableConstants:
return ScrobblableConstants(verb="Playing", tags="game_die")
def primary_image_url(self) -> str:
url = ""
if self.cover:
url = self.cover.url
return url
def bggeek_link(self):
link = ""
if self.bggeek_id:
link = f"https://boardgamegeek.com/boardgame/{self.bggeek_id}"
return link
def fix_metadata(self, data: dict = {}, force_update=False) -> None:
if not self.published_date or force_update:
if not data:
data = lookup_boardgame_from_bgg(str(self.bggeek_id))
cover_url = data.pop("cover_url")
year = data.pop("year_published")
publisher_name = data.pop("publisher_name")
if year:
data["published_year"] = int(year)
if not data["min_players"]:
data.pop("min_players")
if not data["min_players"]:
data.pop("max_players")
# Fun trick for updating all fields at once
BoardGame.objects.filter(pk=self.id).update(**data)
self.refresh_from_db()
# Add publishers
(
self.publisher,
_created,
) = BoardGamePublisher.objects.get_or_create(name=publisher_name)
self.save()
# Go get cover image if the URL is present
if cover_url and not self.cover:
headers = {"User-Agent": "Vrobbler 0.11.12"}
r = requests.get(cover_url, headers=headers)
logger.debug(r.status_code)
if r.status_code == 200:
fname = f"{self.title}_cover_{self.uuid}.jpg"
self.cover.save(fname, ContentFile(r.content), save=True)
logger.debug("Loaded cover image from BGGeek")
@classmethod
def find_or_create(
cls, lookup_id: str, data: Optional[dict] = {}
) -> Optional["BoardGame"]:
"""Given a Lookup ID (either BGG or BGA ID), return a board game object"""
boardgame = cls.objects.filter(bggeek_id=lookup_id).first()
if not data or not boardgame:
data = lookup_boardgame_from_bgg(lookup_id)
if data and not boardgame:
boardgame, created = cls.objects.get_or_create(
title=data["title"], bggeek_id=lookup_id
)
if created:
boardgame.fix_metadata(data=data)
return boardgame

View File

@ -0,0 +1,128 @@
import berserk
from boardgames.models import BoardGame
from django.conf import settings
from django.contrib.auth import get_user_model
from scrobbles.models import Scrobble
from scrobbles.notifications import ScrobbleNtfyNotification
User = get_user_model()
def import_chess_games_for_user_id(user_id: int, commit: bool = False) -> dict:
user = User.objects.get(id=user_id)
client = berserk.Client(
session=berserk.TokenSession(settings.LICHESS_API_KEY)
)
games = client.games.export_by_player(user.profile.lichess_username)
for game_dict in games:
chess, created = BoardGame.objects.get_or_create(title="Chess")
if created:
chess.run_time_seconds = 1800
chess.bggeek_id = 171
chess.save(update_fields=["run_time_seconds", "bggeek_id"])
scrobble = Scrobble.objects.filter(
user_id=user.id,
timestamp=game_dict.get("createdAt"),
board_game_id=chess.id,
).first()
if scrobble:
continue
log_data = {
"variant": game_dict.get("variant"),
"lichess_id": game_dict.get("id"),
"rated": game_dict.get("rated"),
"speed": game_dict.get("speed"),
"moves": game_dict.get("moves"),
"players": [],
}
winner = game_dict.get("winner")
black_player = game_dict.get("players", {}).get("black", {})
white_player = game_dict.get("players", {}).get("white", {})
user_player = {
"user_id": user.id,
"lichess_username": user.profile.lichess_username,
"bgg_username": user.profile.bgg_username,
"color": "",
"win": False,
}
other_player = {"name_str": "", "color": "", "win": False}
if (
black_player.get("user", {}).get("name", "")
== user.profile.lichess_username
):
user_player["color"] = "black"
if "aiLevel" in white_player.keys():
other_player["name_str"] = "aiLevel_" + str(
white_player.get("aiLevel", "")
)
else:
other_player["name_str"] = white_player.get("user", {}).get(
"name", ""
)
other_player["lichess_username"] = other_player["name_str"]
other_player["color"] = "white"
if winner == "black":
user_player["win"] = True
else:
other_player["win"] = True
if (
white_player.get("user", {}).get("name", "")
== user.profile.lichess_username
):
user_player["color"] = "white"
if "aiLevel" in black_player.keys():
other_player["name_str"] = "aiLevel_" + str(
black_player.get("aiLevel", "")
)
else:
other_player["name_str"] = black_player.get("user", {}).get(
"name", ""
)
other_player["lichess_username"] = other_player["name_str"]
other_player["color"] = "black"
if winner == "white":
user_player["win"] = True
else:
other_player["win"] = True
log_data["players"].append(user_player)
log_data["players"].append(other_player)
scrobble_dict = {
"media_type": Scrobble.MediaType.BOARD_GAME,
"user_id": user.id,
"playback_position_seconds": (
game_dict.get("lastMoveAt") - game_dict.get("createdAt")
).seconds,
"in_progress": False,
"played_to_completion": True,
"timestamp": game_dict.get("createdAt"),
"stop_timestamp": game_dict.get("lastMoveAt"),
"board_game_id": chess.id,
"source": "Lichess",
"timezone": user.profile.timezone,
"log": log_data,
}
if commit:
Scrobble.objects.create(**scrobble_dict)
return scrobble_dict
def import_chess_games_for_all_users():
scrobbles_to_create = []
for user in User.objects.filter(profile__lichess_username__isnull=False):
scrobble_dict = import_chess_games_for_user_id(user.id)
scrobbles_to_create.append(Scrobble(**scrobble_dict))
if scrobbles_to_create:
created = Scrobble.objects.bulk_create(scrobbles_to_create)
for scrobble in created:
ScrobbleNtfyNotification(scrobble).send()
return scrobbles_to_create

View File

@ -0,0 +1,23 @@
from django.urls import path
from boardgames import views
app_name = "boardgames"
urlpatterns = [
path(
"board-games/",
views.BoardGameListView.as_view(),
name="boardgame_list",
),
path(
"board-games/<slug:slug>/",
views.BoardGameDetailView.as_view(),
name="boardgame_detail",
),
path(
"board-game-publisher/<slug:slug>/",
views.BoardGamePublisherDetailView.as_view(),
name="publisher_detail",
),
]

View File

View File

@ -0,0 +1,16 @@
from django.views import generic
from boardgames.models import BoardGame, BoardGamePublisher
from scrobbles.views import ScrobbleableListView, ScrobbleableDetailView
class BoardGameListView(ScrobbleableListView):
model = BoardGame
class BoardGameDetailView(ScrobbleableDetailView):
model = BoardGame
class BoardGamePublisherDetailView(generic.DetailView):
model = BoardGamePublisher
slug_field = "uuid"

View File

@ -0,0 +1,50 @@
from books.models import Author, Book, Paper
from django.contrib import admin
from scrobbles.admin import ScrobbleInline
@admin.register(Author)
class AuthorAdmin(admin.ModelAdmin):
date_hierarchy = "created"
list_display = (
"name",
"openlibrary_id",
"bio",
"wikipedia_url",
)
ordering = ("-created",)
search_fields = ("name",)
@admin.register(Book)
class BookAdmin(admin.ModelAdmin):
date_hierarchy = "created"
list_display = (
"title",
"subtitle",
"isbn_13",
"first_publish_year",
"pages",
)
search_fields = ("name",)
ordering = ("-created",)
inlines = [
ScrobbleInline,
]
@admin.register(Paper)
class BookAdmin(admin.ModelAdmin):
date_hierarchy = "created"
list_display = (
"title",
"subtitle",
"arxiv_id",
"first_publish_year",
"pages",
)
search_fields = ("name",)
ordering = ("-created",)
inlines = [
ScrobbleInline,
]

View File

@ -0,0 +1,142 @@
from enum import Enum
from typing import Optional
from bs4 import BeautifulSoup
import requests
import logging
logger = logging.getLogger(__name__)
USER_AGENT = (
"Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0"
)
AMAZON_SEARCH_URL = "https://www.amazon.com/s?k={amazon_id}"
class AmazonAttribute(Enum):
SERIES = 0
PAGES = 1
LANGUAGE = 2
PUBLISHER = 3
PUB_DATE = 4
DIMENSIONS = 5
ISBN_10 = 6
ISBN_13 = 7
def strip_and_clean(text):
return text.strip("\n").rstrip().lstrip()
def get_rating_from_soup(soup) -> Optional[int]:
rating = None
try:
potential_rating = soup.find("div", class_="allmusic-rating")
if potential_rating:
rating = int(strip_and_clean(potential_rating.get_text()))
except ValueError:
pass
return rating
def get_review_from_soup(soup) -> str:
review = ""
try:
potential_text = soup.find("div", class_="text")
if potential_text:
review = strip_and_clean(potential_text.get_text())
except ValueError:
pass
return review
def scrape_data_from_amazon(url) -> dict:
data_dict = {}
headers = {"User-Agent": USER_AGENT}
r = requests.get(url, headers=headers)
if r.status_code == 200:
soup = BeautifulSoup(r.text, "html.parser")
# TODO Fix this scraper
data_dict["rating"] = get_rating_from_soup(soup)
data_dict["review"] = get_review_from_soup(soup)
return data_dict
def get_amazon_product_dict(amazon_id: str) -> dict:
data_dict = {}
url = ""
search_url = AMAZON_SEARCH_URL.format(amazon_id=amazon_id)
headers = {
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
"accept-language": "en-GB,en;q=0.9",
}
response = requests.get(search_url, headers=headers)
if response.status_code != 200:
logger.info(f"Bad http response from Amazon {response}")
return data_dict
soup = BeautifulSoup(response.text, "html.parser")
results = soup.find("a", class_="a-link-normal")
if not results:
logger.info(f"No search results for {amazon_id}")
return data_dict
product_url = "https://www.amazon.com" + str(results.get("href", ""))
data_dict = {}
response = requests.get(product_url, headers=headers)
if response.status_code != 200:
logger.info(f"Bad http response from Amazon {response}")
return data_dict
soup = BeautifulSoup(response.text, "html.parser")
try:
data_dict["title"] = soup.findAll("span", class_="celwidget")[
1
].text.strip()
data_dict["cover_url"] = soup.find("img", class_="frontImage").get(
"src"
)
data_dict["summary"] = soup.findAll(
"div", class_="a-expander-content"
)[1].text
meta = soup.findAll("div", class_="rpi-attribute-value")
data_dict["isbn"] = meta[AmazonAttribute.ISBN_10.value].text.strip()
pages = meta[AmazonAttribute.PAGES.value].text
if "pages" in pages:
data_dict["pages"] = (
meta[AmazonAttribute.PAGES.value]
.text.split("pages")[0]
.strip()
)
except IndexError as e:
logger.error(
f"Amazon lookup is failing for this product {amazon_id}: {e}"
)
except AttributeError as e:
logger.error(
f"Amazon lookup is failing for this product {amazon_id}: {e}"
)
return data_dict
def lookup_book_from_amazon(amazon_id: str) -> dict:
top = {}
return {
"title": top.get("title"),
"isbn": isbn,
"openlibrary_id": ol_id,
"goodreads_id": get_first("id_goodreads", top),
"first_publish_year": top.get("first_publish_year"),
"first_sentence": first_sentence,
"pages": top.get("number_of_pages_median", None),
"cover_url": COVER_URL.format(id=ol_id),
"ol_author_id": ol_author_id,
"subject_key_list": top.get("subject_key", []),
}

View File

@ -0,0 +1,14 @@
from books.models import Author, Book
from rest_framework import serializers
class AuthorSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Author
fields = "__all__"
class BookSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Book
fields = "__all__"

View File

@ -0,0 +1,19 @@
from rest_framework import permissions, viewsets
from books.api.serializers import (
AuthorSerializer,
BookSerializer,
)
from books.models import Author, Book
class AuthorViewSet(viewsets.ModelViewSet):
queryset = Author.objects.all().order_by("-created")
serializer_class = AuthorSerializer
permission_classes = [permissions.IsAuthenticated]
class BookViewSet(viewsets.ModelViewSet):
queryset = Book.objects.all().order_by("-created")
serializer_class = BookSerializer
permission_classes = [permissions.IsAuthenticated]

View File

@ -0,0 +1,233 @@
"""
ComicVine API Information & Documentation:
https://comicvine.gamespot.com/api/
https://comicvine.gamespot.com/api/documentation
"""
import json
import logging
from django.conf import settings
import requests
logger = logging.getLogger(__name__)
class ComicVineClient(object):
"""
Interacts with the ``search`` resource of the ComicVine API. Requires an
account on https://comicvine.gamespot.com/ in order to obtain an API key.
"""
# All API requests made by this client will be made to this URL.
API_URL = "https://www.comicvine.com/api/search/"
# A valid User-Agent header must be set in order for our API requests to
# be accepted, otherwise our request will be rejected with a
# **403 - Forbidden** error.
HEADERS = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:7.0) "
"Gecko/20130825 Firefox/36.0"
}
# A set of valid resource types to return in results.
RESOURCE_TYPES = {
"character",
"issue",
"location",
"object",
"person",
"publisher",
"story_arc",
"team",
"volume",
}
def __init__(self, api_key, expire_after=300):
"""
Store the API key in a class variable, and install the requests cache,
configuring it using the ``expire_after`` parameter.
:param api_key: Your personal ComicVine API key.
:type api_key: str
:param expire_after: The number of seconds to retain an entry in cache.
:type expire_after: int or None
"""
self.api_key = api_key
def search(self, query, offset=0, limit=10, resources=None):
"""
Perform a search against the API, using the provided query term. If
required, a list of resource types to filter search results to can
be included.
Take the JSON contained in the response and provide it to the custom
``Response`` object's constructor. Return the ``Response`` object.
:param query: The search query with which to make the request.
:type query: str
:param offset: The index of the first record returned.
:type offset: int or None
:param limit: How many records to return **(max 10)**
:type limit: int or None
:param resources: A list of resources to include in the search results.
:type resources: list or None
:type use_cache: bool
:return: The response object containing the results of the search
query.
:rtype: comicvine_search.response.Response
"""
params = self._request_params(query, offset, limit, resources)
json_data = self._query_api(params)
return json_data
def _request_params(self, query, offset, limit, resources):
"""
Construct a dict containing the required key-value pairs of parameters
required in order to make the API request.
The documentation for the ``search`` resource can be found at
https://comicvine.gamespot.com/api/documentation#toc-0-30.
Regarding 'limit', as per the documentation:
The number of results to display per page. This value defaults to
10 and can not exceed this number.
:param query: The search query with which to make the request.
:type query: str
:param offset: The index of the first record returned.
:type offset: int
:param limit: How many records to return **(max 10)**
:type limit: int
:param resources: A list of resources to include in the search results.
:type resources: list or None
:return: A dictionary of request parameters.
:rtype: dict
"""
return {
"api_key": self.api_key,
"format": "json",
"limit": min(10, limit), # hard limit of 10
"offset": max(0, offset), # cannot provide negative offset
"query": query,
"resources": self._validate_resources(resources),
}
def _validate_resources(self, resources):
"""
Provided a list of resources, first convert it to a set and perform an
intersection with the set of valid resource types, ``RESOURCE_TYPES``.
Return a comma-separted string of the remaining valid resources, or
None if the set is empty.
:param resources: A list of resources to include in the search results.
:type resources: list or None
:return: A comma-separated string of valid resources.
:rtype: str or None
"""
if not resources:
return None
valid_resources = self.RESOURCE_TYPES & set(resources)
return ",".join(valid_resources) if valid_resources else None
def _query_api(self, params):
"""
Query the ComicVine API's ``search`` resource, providing the required
headers and parameters with the request. Optionally allow the caller
of the function to disable the request cache.
If an error occurs during the request, handle it accordingly. Upon
success, return the JSON from the response.
:param params: Parameters to include with the request.
:type params: dict
:param use_cache: Toggle the use of requests_cache.
:type use_cache: bool
:return: The JSON contained in the response.
:rtype: dict
"""
# Since we're performing the identical action regardless of whether
# or not the request cache is to be used, store the procedure in a
# local function to avoid repetition.
def __httpget():
response = requests.get(
self.API_URL, headers=self.HEADERS, params=params
)
if not response.ok:
self._handle_http_error(response)
return response.json()
return __httpget()
def _handle_http_error(self, response):
"""
Provided a ``requests.Response`` object, if the status code is
anything other than **200**, we will treat it as an error.
Using the response's status code, determine which type of exception to
raise. Construct an exception message from the response's status code
and reason properties before raising the exception.
:param response: The requests.Response object returned by the HTTP
request.
:type response: requests.Response
:raises ComicVineUnauthorizedException: if no API key provided.
:raises ComicVineForbiddenException: if no User-Agent header provided.
:raises ComicVineApiException: if an unidentified error occurs.
"""
exception = {
401: Exception,
403: Exception,
}.get(response.status_code, Exception)
message = f"{response.status_code} {response.reason}"
raise exception(message)
def lookup_comic_from_comicvine(title: str) -> dict:
api_key = getattr(settings, "COMICVINE_API_KEY", "")
if not api_key:
logger.warn("No ComicVine API key configured, not looking anything up")
return {}
client = ComicVineClient(
api_key=getattr(settings, "COMICVINE_API_KEY", None)
)
result = [
r
for r in client.search(title).get("results")
if r.get("resource_type") == "volume"
][0]
if "volume" not in result.keys():
logger.warn("No result found on ComicVine", extra={"title": title})
return {}
title = " ".join([result.get("volume").get("name"), result.get("name)")])
data_dict = {
"title": title,
"cover_url": result.get("image").get("original_url"),
"comicvine_data": {
"id": result.get("id"),
"site_detail_url": result.get("site_detail_url"),
"description": result.get("description"),
"image": result.get("image").get("original_url"),
},
}
return data_dict

View File

@ -0,0 +1,7 @@
#!/usr/bin/env python3
BOOKS_TITLES_TO_IGNORE = [
"KOReader Quickstart Guide",
"zb2rhkSwygt9vjkAEBj7tP5KVgFqejJqsJ2W3bYsrgiiKK8XL",
"zb2rhchGpo7P27mofV9hYjT63d9ZaQnbQ6LSfzmkvsYzvARif",
]

View File

@ -0,0 +1,432 @@
import logging
import re
import sqlite3
from datetime import datetime, timedelta
from enum import Enum
from zoneinfo import ZoneInfo
import requests
from books.constants import BOOKS_TITLES_TO_IGNORE
from django.apps import apps
from django.contrib.auth import get_user_model
from scrobbles.notifications import ScrobbleNtfyNotification
from stream_sqlite import stream_sqlite
from webdav.client import get_webdav_client
logger = logging.getLogger(__name__)
User = get_user_model()
class KoReaderBookColumn(Enum):
ID = 0
TITLE = 1
AUTHORS = 2
NOTES = 3
LAST_OPEN = 4
HIGHLIGHTS = 5
PAGES = 6
SERIES = 7
LANGUAGE = 8
MD5 = 9
TOTAL_READ_TIME = 10
TOTAL_READ_PAGES = 11
class KoReaderPageStatColumn(Enum):
ID_BOOK = 0
PAGE = 1
START_TIME = 2
DURATION = 3
TOTAL_PAGES = 4
def _sqlite_bytes(sqlite_url):
with requests.get(sqlite_url, stream=True) as r:
yield from r.iter_content(chunk_size=65_536)
# Grace period between page reads for it to be a new scrobble
SESSION_GAP_SECONDS = 1800 # a half hour
def get_author_str_from_row(row):
"""Given a the raw author string from KoReader, convert it to a single line and
strip the middle initials, as OpenLibrary lookup usually fails with those.
"""
ko_authors = row[KoReaderBookColumn.AUTHORS.value].replace("\n", ", ")
# Strip middle initials, OpenLibrary often fails with these
return re.sub(" [A-Z]. ", " ", ko_authors)
def lookup_or_create_authors_from_author_str(ko_author_str: str) -> list:
"""Takes a string of authors from KoReader and returns a list
of Authors from our database
"""
from books.models import Author
author_str_list = ko_author_str.split(", ")
author_list = []
for author_str in author_str_list:
logger.debug(f"Looking up author {author_str}")
# KoReader gave us nothing, bail
if author_str == "N/A":
logger.warn(f"KoReader author string is N/A, no authors to find")
continue
author = Author.objects.filter(name=author_str).first()
if not author:
author = Author.objects.create(name=author_str)
# TODO Move these to async processes after importing
# author.fix_metadata()
logger.debug(f"Created author {author}")
author_list.append(author)
return author_list
def create_book_from_row(row: list):
from books.models import Book
# No KoReader book yet, create it
author_str = get_author_str_from_row(row).replace("\x00", "")
total_pages = row[KoReaderBookColumn.PAGES.value]
run_time = total_pages * Book.AVG_PAGE_READING_SECONDS
book_title = row[KoReaderBookColumn.TITLE.value].replace("\x00", "")
if " - " in book_title:
split_title = book_title.split(" - ")
book_title = split_title[0]
if (not author_str or author_str == "N/A") and len(split_title) > 1:
author_str = split_title[1].split("_")[0]
clean_row = []
for value in row:
if isinstance(value, str):
value = value.replace("\x00", "")
clean_row.append(value)
book = Book.objects.create(
title=book_title.replace("_", ":"),
pages=total_pages,
koreader_data_by_hash={
str(row[KoReaderBookColumn.MD5.value]): {
"title": book_title,
"author_str": author_str,
"book_id": row[KoReaderBookColumn.ID.value],
"raw_row_data": clean_row,
}
},
run_time_seconds=run_time,
)
# TODO Move these to async processes after importing
# book.fix_metadata()
# Add authors
author_list = lookup_or_create_authors_from_author_str(author_str)
if author_list:
book.authors.add(*author_list)
# self._lookup_authors
return book
def build_book_map(rows) -> dict:
"""Given an interable of sqlite rows from the books table, lookup existing
books, create ones that don't exist, and return a mapping of koreader IDs to
primary key IDs for page creation.
"""
from books.models import Book
book_id_map = {}
for book_row in rows:
if book_row[KoReaderBookColumn.TITLE.value] in BOOKS_TITLES_TO_IGNORE:
logger.info(
"[build_book_map] Ignoring book title that is likely garbage",
extra={"book_row": book_row, "media_type": "Book"},
)
continue
book = Book.objects.filter(
koreader_data_by_hash__icontains=book_row[
KoReaderBookColumn.MD5.value
]
).first()
if not book:
title = (
book_row[KoReaderBookColumn.TITLE.value]
.split(" - ")[0]
.lower()
.replace("\x00", "")
)
book = Book.objects.filter(title=title).first()
if not book:
book = create_book_from_row(book_row)
book.refresh_from_db()
total_seconds = 0
if book_row[KoReaderBookColumn.TOTAL_READ_TIME.value]:
total_seconds = book_row[KoReaderBookColumn.TOTAL_READ_TIME.value]
book_id_map[book_row[KoReaderBookColumn.ID.value]] = {
"book_id": book.id,
"hash": book_row[KoReaderBookColumn.MD5.value],
"total_seconds": total_seconds,
}
return book_id_map
def build_page_data(page_rows: list, book_map: dict, user_tz=None) -> dict:
"""Given rows of page data from KoReader, parse each row and build
scrobbles for our user, loading the page data into the page_data
field on the scrobble instance.
"""
book_ids_not_found = []
for page_row in page_rows:
koreader_book_id = page_row[KoReaderPageStatColumn.ID_BOOK.value]
if koreader_book_id not in book_map.keys():
book_ids_not_found.append(koreader_book_id)
continue
if "pages" not in book_map[koreader_book_id].keys():
book_map[koreader_book_id]["pages"] = {}
page_number = page_row[KoReaderPageStatColumn.PAGE.value]
duration = page_row[KoReaderPageStatColumn.DURATION.value]
start_ts = page_row[KoReaderPageStatColumn.START_TIME.value]
book_map[koreader_book_id]["pages"][page_number] = {
"duration": duration,
"start_ts": start_ts,
"end_ts": start_ts + duration,
}
if book_ids_not_found:
logger.info(
f"Found pages for books not in file: {set(book_ids_not_found)}"
)
return book_map
def build_scrobbles_from_book_map(
book_map: dict, user: "User"
) -> list["Scrobble"]:
Scrobble = apps.get_model("scrobbles", "Scrobble")
scrobbles_to_create = []
pages_not_found = []
for koreader_book_id, book_dict in book_map.items():
book_id = book_dict["book_id"]
if "pages" not in book_dict.keys():
pages_not_found.append(book_id)
continue
should_create_scrobble = False
scrobble_page_data = {}
playback_position_seconds = 0
prev_page_stats = {}
last_page_number = 0
pages_processed = 0
total_pages_read = len(book_map[koreader_book_id]["pages"])
ordered_pages = sorted(
book_map[koreader_book_id]["pages"].items(),
key=lambda x: x[1]["start_ts"],
)
for cur_page_number, stats in ordered_pages:
pages_processed += 1
seconds_from_last_page = 0
if prev_page_stats:
seconds_from_last_page = stats.get(
"end_ts"
) - prev_page_stats.get("start_ts")
playback_position_seconds = playback_position_seconds + stats.get(
"duration"
)
end_of_reading = pages_processed == total_pages_read
big_jump_to_this_page = (cur_page_number - last_page_number) > 10
is_session_gap = seconds_from_last_page > SESSION_GAP_SECONDS
if (
is_session_gap and not big_jump_to_this_page
) or end_of_reading:
should_create_scrobble = True
if should_create_scrobble:
scrobble_page_data = dict(
sorted(
scrobble_page_data.items(),
key=lambda x: x[1]["start_ts"],
)
)
try:
first_page = scrobble_page_data.get(
list(scrobble_page_data.keys())[0]
)
last_page = scrobble_page_data.get(
list(scrobble_page_data.keys())[-1]
)
except IndexError:
logger.error(
"Could not process book, no page data found",
extra={"scrobble_page_data": scrobble_page_data},
)
continue
timestamp = user.profile.get_timestamp_with_tz(
datetime.fromtimestamp(int(first_page.get("start_ts")))
)
stop_timestamp = user.profile.get_timestamp_with_tz(
datetime.fromtimestamp(int(last_page.get("end_ts")))
)
# Adjust for Daylight Saving Time
if timestamp.dst() == timedelta(
0
) or stop_timestamp.dst() == timedelta(0):
timestamp = timestamp - timedelta(hours=1)
stop_timestamp = stop_timestamp - timedelta(hours=1)
scrobble = Scrobble.objects.filter(
timestamp=timestamp,
book_id=book_id,
user_id=user.id,
).first()
if not scrobble:
logger.info(
f"Queueing scrobble for {book_id}, page {cur_page_number}"
)
log_data = {
"koreader_hash": book_dict.get("hash"),
"page_data": scrobble_page_data,
"pages_read": len(scrobble_page_data.keys()),
}
scrobbles_to_create.append(
Scrobble(
book_id=book_id,
user_id=user.id,
source="KOReader",
media_type=Scrobble.MediaType.BOOK,
timestamp=timestamp,
log=log_data,
stop_timestamp=stop_timestamp,
playback_position_seconds=playback_position_seconds,
in_progress=False,
played_to_completion=True,
long_play_complete=False,
timezone=timestamp.tzinfo.name,
)
)
# Then start over
should_create_scrobble = False
playback_position_seconds = 0
scrobble_page_data = {}
# We accumulate pages for the scrobble until we should create a new one
scrobble_page_data[cur_page_number] = stats
last_page_number = cur_page_number
prev_page_stats = stats
if pages_not_found:
logger.info(f"Pages not found for books: {set(pages_not_found)}")
return scrobbles_to_create
def fix_long_play_stats_for_scrobbles(scrobbles: list) -> None:
"""Given a list of scrobbles, update pages read, long play seconds and check
for media completion"""
for scrobble in scrobbles:
# But if there's a next scrobble, set pages read to their starting page
if scrobble.previous and not scrobble.previous.long_play_complete:
scrobble.long_play_seconds = scrobble.playback_position_seconds + (
scrobble.previous.long_play_seconds or 0
)
else:
scrobble.long_play_seconds = scrobble.playback_position_seconds
scrobble.log["book_pages_read"] = scrobble.calc_pages_read()
scrobble.save(update_fields=["log", "long_play_seconds"])
def process_koreader_sqlite_file(file_path, user_id) -> list:
"""Given a sqlite file from KoReader, open the book table, iterate
over rows creating scrobbles from each book found"""
Scrobble = apps.get_model("scrobbles", "Scrobble")
new_scrobbles = []
user = User.objects.filter(id=user_id).first()
tz = ZoneInfo("UTC")
if user:
tz = user.profile.tzinfo
is_os_file = "https://" not in file_path
if is_os_file:
# Loading sqlite file from local filesystem
con = sqlite3.connect(file_path)
cur = con.cursor()
try:
book_map = build_book_map(cur.execute("SELECT * FROM book"))
except sqlite3.OperationalError:
logger.warning("KOReader sqlite file had not table: book")
return new_scrobbles
book_map = build_page_data(
cur.execute(
"SELECT * from page_stat_data ORDER BY id_book, start_time"
),
book_map,
tz,
)
new_scrobbles = build_scrobbles_from_book_map(book_map, user)
else:
# Streaming the sqlite file off S3
book_map = {}
for table_name, pragma_table_info, rows in stream_sqlite(
_sqlite_bytes(file_path), max_buffer_size=1_048_576
):
logger.debug(f"Found table {table_name} - processing")
if table_name == "book":
book_map = build_book_map(rows)
for table_name, pragma_table_info, rows in stream_sqlite(
_sqlite_bytes(file_path), max_buffer_size=1_048_576
):
if table_name == "page_stat_data":
book_map = build_page_data(rows, book_map, tz)
new_scrobbles = build_scrobbles_from_book_map(book_map, user)
logger.info(f"Creating {len(new_scrobbles)} new scrobbles")
created = []
if new_scrobbles:
created = Scrobble.objects.bulk_create(new_scrobbles)
if created:
ScrobbleNtfyNotification(created[-1]).send()
fix_long_play_stats_for_scrobbles(created)
logger.info(
f"Created {len(created)} scrobbles",
extra={"created_scrobbles": created},
)
return created
def fetch_file_from_webdav(user_id: int) -> str:
file_path = f"/tmp/{user_id}-koreader-import.sqlite3"
client = get_webdav_client(user_id)
if not client:
logger.warning("could not get webdav client for user")
# TODO maybe we raise an exception here?
return ""
client.download_sync(
remote_path="var/koreader/statistics.sqlite3",
local_path=file_path,
)
return file_path

123
vrobbler/apps/books/locg.py Normal file
View File

@ -0,0 +1,123 @@
#!/usr/bin/env python3
from typing import Optional
from bs4 import BeautifulSoup
import requests
import logging
logger = logging.getLogger(__name__)
HEADERS = {
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
"accept-language": "en-GB,en;q=0.9",
}
LOCG_WRTIER_URL = ""
LOCG_WRITER_DETAIL_URL = "https://leagueofcomicgeeks.com/people/{slug}"
LOCG_SEARCH_URL = (
"https://leagueofcomicgeeks.com/search/ajax_issues?query={query}"
)
LOCG_DETAIL_URL = "https://leagueofcomicgeeks.com/comic/{locg_slug}"
def strip_and_clean(text):
return text.strip("\n").strip()
def get_rating_from_soup(soup) -> Optional[int]:
rating = None
try:
potential_rating = soup.find("div", class_="allmusic-rating")
if potential_rating:
rating = int(strip_and_clean(potential_rating.get_text()))
except ValueError:
pass
return rating
def lookup_comic_writer_by_locg_slug(slug: str) -> dict:
data_dict = {}
writer_url = LOCG_WRITER_DETAIL_URL.format(slug=slug)
response = requests.get(writer_url, headers=HEADERS)
if response.status_code != 200:
logger.info(f"Bad http response from LOCG {response}")
return data_dict
soup = BeautifulSoup(response.text, "html.parser")
data_dict["locg_slug"] = slug
data_dict["name"] = soup.find("h1").text.strip()
data_dict["photo_url"] = soup.find("div", class_="avatar").img.get("src")
return data_dict
def lookup_comic_by_locg_slug(slug: str) -> dict:
data_dict = {}
product_url = LOCG_DETAIL_URL.format(locg_slug=slug)
response = requests.get(product_url, headers=HEADERS)
if response.status_code != 200:
logger.info(f"Bad http response from LOCG {response}")
return data_dict
soup = BeautifulSoup(response.text, "html.parser")
try:
data_dict["title"] = soup.find("h1").text.strip()
data_dict["summary"] = soup.find("p").text.strip()
data_dict["cover_url"] = (
soup.find("div", class_="cover-art").find("img").get("src")
)
attrs = soup.findAll("div", class_="details-addtl-block")
try:
data_dict["pages"] = (
attrs[1]
.find("div", class_="value")
.text.split("pages")[0]
.strip()
)
except IndexError:
logger.warn(f"No ISBN field")
try:
data_dict["isbn"] = (
attrs[3].find("div", class_="value").text.strip()
)
except IndexError:
logger.warn(f"No ISBN field")
writer_slug = None
try:
writer_slug = (
soup.findAll("div", class_="name")[5]
.a.get("href")
.split("people/")[1]
)
except IndexError:
logger.warn(f"No wrtier found")
if writer_slug:
data_dict["locg_writer_slug"] = writer_slug
except AttributeError:
logger.warn(f"Trouble parsing HTML, elements missing")
return data_dict
def lookup_comic_from_locg(title: str) -> dict:
search_url = LOCG_SEARCH_URL.format(query=title)
response = requests.get(search_url, headers=HEADERS)
if response.status_code != 200:
logger.warn(f"Bad http response from LOCG {response}")
return {}
soup = BeautifulSoup(response.text, "html.parser")
try:
slug = soup.findAll("a")[1].get("href").split("comic/")[1]
except IndexError:
logger.warn(f"No comic found on LOCG for {title}")
return {}
return lookup_comic_by_locg_slug(slug)

View File

@ -0,0 +1,42 @@
#!/usr/bin/env python3
import logging
import pytz
from datetime import datetime, timedelta
from books.models import Book
from django.core.management.base import BaseCommand
from scrobbles.models import Scrobble
from vrobbler.apps.books.koreader import fix_long_play_stats_for_scrobbles
from vrobbler.apps.scrobbles.utils import timestamp_user_tz_to_utc
logger = logging.getLogger(__name__)
# Grace period between page reads for it to be a new scrobble
SESSION_GAP_SECONDS = 1800 # a half hour
def update_scrobble_from_page_data(scrobble, commit=True):
page_list = list(scrobble.book_page_data.items())
first_page_start_ts = datetime.fromtimestamp(page_list[0][1]["start_ts"])
last_page_end_ts = datetime.fromtimestamp(page_list[-1][1]["end_ts"])
if (
datetime(2023, 10, 15) <= first_page_start_ts <= datetime(2023, 12, 15)
):
first_page_start_ts.replace(tzinfo=pytz.timezone("Europe/Paris"))
last_page_end_ts.replace(tzinfo=pytz.timezone("Europe/Paris"))
else:
first_page_start_ts.replace(tzinfo=pytz.timezone("US/Eastern"))
last_page_end_ts.replace(tzinfo=pytz.timezone("US/Eastern"))
scrobble.timestamp = first_page_start_ts
scrobble.stop_timestamp = last_page_end_ts
if commit:
scrobble.save(update_fields=["timestamp", "stop_timestamp"])
class Command(BaseCommand):
def handle(self, *args, **options):
scrobbles_to_create = []
for scrobble in Scrobble.objects.filter(media_type="Book", source="KOReader"):
update_scrobble_from_page_data(scrobble)

View File

@ -0,0 +1,160 @@
import logging
import pytz
from datetime import datetime, timedelta
from books.models import Book
from django.core.management.base import BaseCommand
from scrobbles.models import Scrobble
from vrobbler.apps.books.koreader import fix_long_play_stats_for_scrobbles
from vrobbler.apps.scrobbles.utils import timestamp_user_tz_to_utc
logger = logging.getLogger(__name__)
# Grace period between page reads for it to be a new scrobble
SESSION_GAP_SECONDS = 1800 # a half hour
class Command(BaseCommand):
def handle(self, *args, **options):
scrobbles_to_create = []
for book in Book.objects.filter(koreader_id__isnull=False):
book.scrobble_set.all().delete()
koreader_data = book.koreader_data_by_hash or {}
if book.koreader_md5:
koreader_data[book.koreader_md5] = {
"title": book.title,
"book_id": book.koreader_id,
"author_str": book.koreader_authors,
"pages": book.pages,
}
book.koreader_data_by_hash = koreader_data
book.save(update_fields=["koreader_data_by_hash"])
# Next parse all this book's pages into new scrobbles
should_create_scrobble = False
scrobble_page_data = {}
playback_position_seconds = 0
prev_page = None
pages_processed = 0
total_pages = book.pages
for page in book.page_set.order_by("number"):
user = page.user
book_id = page.book.id
pages_processed += 1
scrobble_page_data[page.number] = {
"duration": page.duration_seconds,
"start_ts": page.start_time.timestamp(),
"end_ts": page.end_time.timestamp(),
}
seconds_from_last_page = 0
if prev_page:
seconds_from_last_page = (
page.end_time.timestamp()
- prev_page.start_time.timestamp()
)
playback_position_seconds = (
playback_position_seconds + page.duration_seconds
)
end_of_reading = pages_processed == total_pages
big_jump_to_this_page = False
if prev_page:
big_jump_to_this_page = (
page.number - prev_page.number
) > 10
if (
seconds_from_last_page > SESSION_GAP_SECONDS
and not big_jump_to_this_page
):
should_create_scrobble = True
if should_create_scrobble:
first_page = scrobble_page_data.get(
list(scrobble_page_data.keys())[0]
)
last_page = scrobble_page_data.get(
list(scrobble_page_data.keys())[-1]
)
start_ts = int(first_page.get("start_ts"))
end_ts = start_ts + playback_position_seconds
timestamp = datetime.fromtimestamp(start_ts).replace(
tzinfo=user.profile.tzinfo
)
stop_timestamp = datetime.fromtimestamp(end_ts).replace(
tzinfo=user.profile.tzinfo
)
# Add a shim here temporarily to fix imports while we were in France
# if date is between 10/15 and 12/15, cast it to Europe/Central
if (
datetime(2023, 10, 15).replace(
tzinfo=pytz.timezone("Europe/Paris")
)
<= timestamp
<= datetime(2023, 12, 15).replace(
tzinfo=pytz.timezone("Europe/Paris")
)
):
timestamp.replace(tzinfo=pytz.timezone("Europe/Paris"))
elif (
timestamp.tzinfo._dst.seconds == 0
or stop_timestamp.tzinfo._dst.seconds == 0
):
timestamp = timestamp - timedelta(hours=1)
stop_timestamp = stop_timestamp - timedelta(hours=1)
scrobble = Scrobble.objects.filter(
timestamp=timestamp,
book_id=book_id,
user_id=user.id,
).first()
if scrobble:
logger.info(
f"Found existing scrobble {scrobble}, updating"
)
scrobble.book_page_data = scrobble_page_data
scrobble.playback_position_seconds = (
scrobble.calc_reading_duration()
)
scrobble.save(
update_fields=[
"book_page_data",
"playback_position_seconds",
]
)
if not scrobble:
logger.info(
f"Queueing scrobble for {book_id}, page {page.number}"
)
scrobbles_to_create.append(
Scrobble(
book_id=book_id,
user_id=user.id,
source="KOReader",
media_type=Scrobble.MediaType.BOOK,
timestamp=timestamp,
stop_timestamp=stop_timestamp,
playback_position_seconds=playback_position_seconds,
book_koreader_hash=list(
book.koreader_data_by_hash.keys()
)[0],
book_page_data=scrobble_page_data,
book_pages_read=page.number,
in_progress=False,
played_to_completion=True,
long_play_complete=False,
)
)
# Then start over
should_create_scrobble = False
playback_position_seconds = 0
scrobble_page_data = {}
prev_page = page
created = Scrobble.objects.bulk_create(scrobbles_to_create)
fix_long_play_stats_for_scrobbles(created)

View File

@ -0,0 +1,29 @@
import logging
import pytz
from datetime import datetime, timedelta
from books.models import Book
from django.core.management.base import BaseCommand
from scrobbles.models import Scrobble
from vrobbler.apps.books.koreader import fix_long_play_stats_for_scrobbles
from vrobbler.apps.scrobbles.utils import timestamp_user_tz_to_utc
logger = logging.getLogger(__name__)
class Command(BaseCommand):
def handle(self, *args, **options):
total_books = Book.objects.all().count()
processed_books = 0
for book in Book.objects.all():
for scrobble in book.scrobble_set.all():
log_data = {
"koreader_hash": scrobble.book_koreader_hash,
"page_data": scrobble.book_page_data,
"pages_read": scrobble.book_pages_read,
}
scrobble.log = log_data
scrobble.save(update_fields=["log"])
processed_books += 1
logger.info(f"Processed book {processed_books} of {total_books}")

View File

@ -0,0 +1,40 @@
from enum import Enum
from typing import Optional
import pendulum
YOUTUBE_VIDEO_URL = "https://www.youtube.com/watch?v="
IMDB_VIDEO_URL = "https://www.imdb.com/title/tt"
class BookType:
...
class BookMetadata:
title: str
run_time_seconds: Optional[int]
authors = Optional[str]
goodreads_id = Optional[str]
koreader_data_by_hash = Optional[dict]
isbn = Optional[str]
# isbn_13 = Optional[str]
# isbn_10 = Optional[str]
pages = Optional[int]
language = Optional[str]
first_publish_year = Optional[int]
summary = Optional[str]
# General
cover_url: Optional[str]
genres: list[str]
def __init__(self, title: Optional[str] = ""):
self.title = title
def as_dict_with_authors_cover_and_genres(self) -> tuple:
book_dict = vars(self)
authors = book_dict.pop("authors")
cover = book_dict.pop("cover_url")
genres = book_dict.pop("genres")
return book_dict, authors, cover, genres

View File

@ -0,0 +1,128 @@
# Generated by Django 4.1.5 on 2023-02-19 20:17
from django.db import migrations, models
import django_extensions.db.fields
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name='Author',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
(
'created',
django_extensions.db.fields.CreationDateTimeField(
auto_now_add=True, verbose_name='created'
),
),
(
'modified',
django_extensions.db.fields.ModificationDateTimeField(
auto_now=True, verbose_name='modified'
),
),
('name', models.CharField(max_length=255)),
(
'openlibrary_id',
models.CharField(blank=True, max_length=255, null=True),
),
],
options={
'get_latest_by': 'modified',
'abstract': False,
},
),
migrations.CreateModel(
name='Book',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
(
'created',
django_extensions.db.fields.CreationDateTimeField(
auto_now_add=True, verbose_name='created'
),
),
(
'modified',
django_extensions.db.fields.ModificationDateTimeField(
auto_now=True, verbose_name='modified'
),
),
(
'uuid',
models.UUIDField(
blank=True,
default=uuid.uuid4,
editable=False,
null=True,
),
),
(
'run_time',
models.CharField(blank=True, max_length=8, null=True),
),
(
'run_time_ticks',
models.PositiveBigIntegerField(blank=True, null=True),
),
('title', models.CharField(max_length=255)),
(
'openlibrary_id',
models.CharField(blank=True, max_length=255, null=True),
),
(
'goodreads_id',
models.CharField(blank=True, max_length=255, null=True),
),
('koreader_id', models.IntegerField(blank=True, null=True)),
(
'koreader_authors',
models.CharField(blank=True, max_length=255, null=True),
),
(
'koreader_md5',
models.CharField(blank=True, max_length=255, null=True),
),
(
'isbn',
models.CharField(blank=True, max_length=255, null=True),
),
('pages', models.IntegerField(blank=True, null=True)),
(
'language',
models.CharField(blank=True, max_length=4, null=True),
),
(
'first_publish_year',
models.IntegerField(blank=True, null=True),
),
('authors', models.ManyToManyField(to='books.author')),
],
options={
'abstract': False,
},
),
]

View File

@ -0,0 +1,23 @@
# Generated by Django 4.1.5 on 2023-03-06 05:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0001_initial"),
]
operations = [
migrations.AddField(
model_name="book",
name="author_name",
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name="book",
name="author_openlibrary_id",
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View File

@ -0,0 +1,20 @@
# Generated by Django 4.1.5 on 2023-03-06 05:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0002_book_author_name_book_author_openlibrary_id"),
]
operations = [
migrations.AddField(
model_name="book",
name="cover",
field=models.ImageField(
blank=True, null=True, upload_to="books/covers/"
),
),
]

View File

@ -0,0 +1,69 @@
# Generated by Django 4.1.5 on 2023-03-06 16:31
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
("books", "0003_book_cover"),
]
operations = [
migrations.RemoveField(
model_name="book",
name="author_name",
),
migrations.RemoveField(
model_name="book",
name="author_openlibrary_id",
),
migrations.AddField(
model_name="author",
name="headshot",
field=models.ImageField(
blank=True, null=True, upload_to="books/authors/"
),
),
migrations.CreateModel(
name="Page",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created",
django_extensions.db.fields.CreationDateTimeField(
auto_now_add=True, verbose_name="created"
),
),
(
"modified",
django_extensions.db.fields.ModificationDateTimeField(
auto_now=True, verbose_name="modified"
),
),
("number", models.IntegerField()),
("start_time", models.DateTimeField()),
("duration_seconds", models.IntegerField()),
(
"book",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="books.book",
),
),
],
options={
"unique_together": {("book", "number")},
},
),
]

View File

@ -0,0 +1,21 @@
# Generated by Django 4.1.5 on 2023-03-06 16:34
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
("books", "0004_remove_book_author_name_and_more"),
]
operations = [
migrations.AddField(
model_name="author",
name="uuid",
field=models.UUIDField(
blank=True, default=uuid.uuid4, editable=False, null=True
),
),
]

View File

@ -0,0 +1,23 @@
# Generated by Django 4.1.5 on 2023-03-06 17:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0005_author_uuid"),
]
operations = [
migrations.AlterField(
model_name="page",
name="duration_seconds",
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name="page",
name="start_time",
field=models.DateTimeField(blank=True, null=True),
),
]

View File

@ -0,0 +1,48 @@
# Generated by Django 4.1.5 on 2023-03-06 17:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0006_alter_page_duration_seconds_alter_page_start_time"),
]
operations = [
migrations.AddField(
model_name="author",
name="amazon_id",
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name="author",
name="bio",
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name="author",
name="goodreads_id",
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name="author",
name="isni",
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name="author",
name="librarything_id",
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name="author",
name="wikidata_id",
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name="author",
name="wikipedia_url",
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View File

@ -0,0 +1,21 @@
# Generated by Django 4.1.5 on 2023-03-06 18:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
(
"books",
"0007_author_amazon_id_author_bio_author_goodreads_id_and_more",
),
]
operations = [
migrations.AddField(
model_name="book",
name="first_sentence",
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.1.5 on 2023-03-12 01:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0008_book_first_sentence"),
]
operations = [
migrations.AlterField(
model_name="book",
name="run_time",
field=models.IntegerField(blank=True, null=True),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.1.5 on 2023-03-12 01:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("books", "0009_alter_book_run_time"),
]
operations = [
migrations.RenameField(
model_name="book",
old_name="run_time",
new_name="run_time_seconds",
),
]

View File

@ -0,0 +1,25 @@
# Generated by Django 4.1.5 on 2023-03-14 22:27
from django.db import migrations
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
("scrobbles", "0033_genre_objectwithgenres"),
("books", "0010_rename_run_time_book_run_time_seconds"),
]
operations = [
migrations.AddField(
model_name="book",
name="genre",
field=taggit.managers.TaggableManager(
help_text="A comma-separated list of tags.",
through="scrobbles.ObjectWithGenres",
to="scrobbles.Genre",
verbose_name="Tags",
),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.1.7 on 2023-03-26 02:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0011_book_genre"),
]
operations = [
migrations.AddField(
model_name="page",
name="end_time",
field=models.DateTimeField(blank=True, null=True),
),
]

View File

@ -0,0 +1,26 @@
# Generated by Django 4.1.7 on 2023-03-26 05:31
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("books", "0012_page_end_time"),
]
operations = [
migrations.AddField(
model_name="page",
name="user",
field=models.ForeignKey(
default=1,
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
preserve_default=False,
),
]

View File

@ -0,0 +1,26 @@
# Generated by Django 4.1.7 on 2023-04-18 02:33
from django.db import migrations
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
("scrobbles", "0040_alter_scrobble_media_type"),
("books", "0013_page_user"),
]
operations = [
migrations.AlterField(
model_name="book",
name="genre",
field=taggit.managers.TaggableManager(
blank=True,
help_text="A comma-separated list of tags.",
through="scrobbles.ObjectWithGenres",
to="scrobbles.Genre",
verbose_name="Tags",
),
),
]

View File

@ -0,0 +1,30 @@
# Generated by Django 4.1.7 on 2023-08-19 02:47
from django.db import migrations, models
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
("scrobbles", "0043_scrobbledpage"),
("books", "0014_alter_book_genre"),
]
operations = [
migrations.AlterField(
model_name="book",
name="first_sentence",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="book",
name="genre",
field=taggit.managers.TaggableManager(
help_text="A comma-separated list of tags.",
through="scrobbles.ObjectWithGenres",
to="scrobbles.Genre",
verbose_name="Tags",
),
),
]

View File

@ -0,0 +1,23 @@
# Generated by Django 4.1.7 on 2023-08-26 04:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0015_alter_book_first_sentence_alter_book_genre"),
]
operations = [
migrations.AddField(
model_name="book",
name="locg_slug",
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name="book",
name="summary",
field=models.TextField(blank=True, null=True),
),
]

View File

@ -0,0 +1,20 @@
# Generated by Django 4.1.7 on 2023-08-26 16:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0016_book_locg_slug_book_summary"),
]
operations = [
migrations.AlterField(
model_name="book",
name="authors",
field=models.ManyToManyField(
blank=True, null=True, to="books.author"
),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.1.7 on 2023-08-31 03:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0017_alter_book_authors"),
]
operations = [
migrations.AddField(
model_name="author",
name="locg_slug",
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.1.7 on 2023-11-21 23:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0018_author_locg_slug"),
]
operations = [
migrations.AlterField(
model_name="book",
name="authors",
field=models.ManyToManyField(blank=True, to="books.author"),
),
]

View File

@ -0,0 +1,28 @@
# Generated by Django 4.2.9 on 2024-01-29 05:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0019_alter_book_authors"),
]
operations = [
migrations.AddField(
model_name="author",
name="comicvine_data",
field=models.JSONField(blank=True, null=True),
),
migrations.AddField(
model_name="book",
name="comicvine_data",
field=models.JSONField(blank=True, null=True),
),
migrations.AddField(
model_name="book",
name="koreader_data_by_hash",
field=models.JSONField(blank=True, null=True),
),
]

View File

@ -0,0 +1,25 @@
# Generated by Django 4.2.16 on 2024-10-17 20:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("books", "0020_author_comicvine_data_book_comicvine_data_and_more"),
]
operations = [
migrations.RemoveField(
model_name="book",
name="koreader_authors",
),
migrations.RemoveField(
model_name="book",
name="koreader_id",
),
migrations.RemoveField(
model_name="book",
name="koreader_md5",
),
]

View File

@ -0,0 +1,21 @@
# Generated by Django 4.2.16 on 2025-01-22 03:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
(
"books",
"0021_remove_book_koreader_authors_remove_book_koreader_id_and_more",
),
]
operations = [
migrations.AlterField(
model_name="book",
name="run_time_seconds",
field=models.IntegerField(default=900),
),
]

View File

@ -0,0 +1,40 @@
# Generated by Django 4.2.18 on 2025-01-27 04:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0022_alter_book_run_time_seconds"),
]
operations = [
migrations.RenameField(
model_name="book",
old_name="isbn",
new_name="isbn_13",
),
migrations.RemoveField(
model_name="book",
name="comicvine_data",
),
migrations.RemoveField(
model_name="book",
name="goodreads_id",
),
migrations.RemoveField(
model_name="book",
name="locg_slug",
),
migrations.AddField(
model_name="book",
name="isbn_10",
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name="book",
name="publish_date",
field=models.DateField(blank=True, null=True),
),
]

View File

@ -0,0 +1,21 @@
# Generated by Django 4.2.18 on 2025-01-27 04:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
(
"books",
"0023_rename_isbn_book_isbn_13_remove_book_comicvine_data_and_more",
),
]
operations = [
migrations.AddField(
model_name="book",
name="publisher",
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View File

@ -0,0 +1,136 @@
# Generated by Django 4.2.19 on 2025-02-18 05:11
from django.db import migrations, models
import django_extensions.db.fields
import taggit.managers
import uuid
class Migration(migrations.Migration):
dependencies = [
("scrobbles", "0067_scrobble_food_alter_scrobble_media_type"),
("books", "0024_book_publisher"),
]
operations = [
migrations.RemoveField(
model_name="author",
name="amazon_id",
),
migrations.RemoveField(
model_name="author",
name="librarything_id",
),
migrations.RemoveField(
model_name="author",
name="locg_slug",
),
migrations.AddField(
model_name="author",
name="semantic_id",
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.CreateModel(
name="Paper",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created",
django_extensions.db.fields.CreationDateTimeField(
auto_now_add=True, verbose_name="created"
),
),
(
"modified",
django_extensions.db.fields.ModificationDateTimeField(
auto_now=True, verbose_name="modified"
),
),
(
"uuid",
models.UUIDField(
blank=True,
default=uuid.uuid4,
editable=False,
null=True,
),
),
("run_time_seconds", models.IntegerField(default=900)),
(
"run_time_ticks",
models.PositiveBigIntegerField(blank=True, null=True),
),
("title", models.CharField(max_length=255)),
("semantic_title", models.CharField(max_length=255)),
(
"koreader_data_by_hash",
models.JSONField(blank=True, null=True),
),
(
"semantic_id",
models.CharField(blank=True, max_length=50, null=True),
),
(
"arxiv_id",
models.CharField(blank=True, max_length=50, null=True),
),
(
"corpus_id",
models.CharField(blank=True, max_length=50, null=True),
),
(
"doi_id",
models.CharField(blank=True, max_length=50, null=True),
),
("pages", models.IntegerField(blank=True, null=True)),
(
"language",
models.CharField(blank=True, max_length=4, null=True),
),
(
"first_publish_year",
models.IntegerField(blank=True, null=True),
),
("publish_date", models.DateField(blank=True, null=True)),
(
"journal",
models.CharField(blank=True, max_length=255, null=True),
),
(
"journal_volume",
models.CharField(blank=True, max_length=50, null=True),
),
("abstract", models.TextField(blank=True, null=True)),
("num_citations", models.IntegerField(blank=True, null=True)),
(
"openaccess_pdf_url",
models.CharField(blank=True, max_length=255, null=True),
),
(
"authors",
models.ManyToManyField(blank=True, to="books.author"),
),
(
"genre",
taggit.managers.TaggableManager(
help_text="A comma-separated list of tags.",
through="scrobbles.ObjectWithGenres",
to="scrobbles.Genre",
verbose_name="Tags",
),
),
],
options={
"abstract": False,
},
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.2.19 on 2025-02-18 05:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0025_remove_author_amazon_id_and_more"),
]
operations = [
migrations.AlterField(
model_name="paper",
name="semantic_title",
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View File

@ -0,0 +1,22 @@
# Generated by Django 4.2.19 on 2025-02-18 05:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("books", "0026_alter_paper_semantic_title"),
]
operations = [
migrations.RemoveField(
model_name="paper",
name="num_citations",
),
migrations.AddField(
model_name="paper",
name="tldr",
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View File

@ -0,0 +1,16 @@
# Generated by Django 4.2.19 on 2025-04-07 17:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("books", "0027_remove_paper_num_citations_paper_tldr"),
]
operations = [
migrations.DeleteModel(
name="Page",
),
]

Some files were not shown because too many files have changed in this diff Show More