Fixed synchronize statistics issues. Added current state to readme.

This commit is contained in:
Tiberiu Chibici 2018-10-29 23:04:10 +02:00
parent c07d1b61f0
commit 97e7e792f8
3 changed files with 74 additions and 56 deletions

View File

@ -4,7 +4,7 @@
<list default="true" id="245751b6-c863-4572-8723-8499964fe105" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/YtManagerApp/management/jobs/synchronize.py" beforeDir="false" afterPath="$PROJECT_DIR$/YtManagerApp/management/jobs/synchronize.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/external/pytaw/pytaw/youtube.py" beforeDir="false" afterPath="$PROJECT_DIR$/external/pytaw/pytaw/youtube.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/readme.md" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@ -151,7 +151,7 @@
<entry key="gitignore" value="1" />
<entry key="html" value="4" />
<entry key="ini" value="5" />
<entry key="md" value="6" />
<entry key="md" value="7" />
<entry key="py" value="49" />
<entry key="scss" value="2" />
<entry key="ytmanagerapp_channel" value="1" />
@ -164,7 +164,7 @@
<entry key="Database Element" value="7" />
<entry key="HTML" value="4" />
<entry key="Ini" value="5" />
<entry key="Markdown" value="6" />
<entry key="Markdown" value="7" />
<entry key="PLAIN_TEXT" value="1" />
<entry key="Python" value="49" />
<entry key="SCSS" value="2" />
@ -175,8 +175,8 @@
<entry key="Django Console" value="265" />
<entry key="html" value="12" />
<entry key="ini" value="2" />
<entry key="md" value="3860" />
<entry key="py" value="3255" />
<entry key="md" value="4844" />
<entry key="py" value="3277" />
<entry key="py@youtube-channel-manager" value="41" />
</counts>
</usages-collector>
@ -186,9 +186,9 @@
<entry key="CommandLine" value="23" />
<entry key="HTML" value="12" />
<entry key="Ini" value="2" />
<entry key="Markdown" value="3856" />
<entry key="Markdown" value="4840" />
<entry key="PLAIN_TEXT" value="18" />
<entry key="Python" value="3520" />
<entry key="Python" value="3542" />
</counts>
</usages-collector>
</session>
@ -198,8 +198,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/YtManagerApp/management/jobs/synchronize.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="31" column="33" selection-start-line="31" selection-start-column="33" selection-end-line="31" selection-end-column="33" />
<state relative-caret-position="525">
<caret line="41" selection-start-line="41" selection-end-line="41" />
<folding>
<element signature="e#0#12#0" expanded="true" />
</folding>
@ -208,10 +208,22 @@
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/readme.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="330">
<caret line="22" column="15" lean-forward="true" selection-start-line="22" selection-start-column="15" selection-end-line="22" selection-end-column="15" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/external/pytaw/pytaw/youtube.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="429">
<caret line="171" column="32" selection-start-line="171" selection-start-column="32" selection-end-line="171" selection-end-column="32" />
<state relative-caret-position="-11204">
<caret line="163" column="29" selection-start-line="163" selection-start-column="29" selection-end-line="163" selection-end-column="29" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
@ -334,10 +346,10 @@
<option value="$PROJECT_DIR$/YtManagerApp/templates/YtManagerApp/master_default.html" />
<option value="$PROJECT_DIR$/YtManagerApp/templates/YtManagerApp/index.html" />
<option value="$PROJECT_DIR$/YtManager/settings.py" />
<option value="$PROJECT_DIR$/readme.md" />
<option value="$PROJECT_DIR$/YtManagerApp/templates/YtManagerApp/controls/subscription_delete_modal.html" />
<option value="$PROJECT_DIR$/YtManagerApp/management/jobs/synchronize.py" />
<option value="$PROJECT_DIR$/external/pytaw/pytaw/youtube.py" />
<option value="$PROJECT_DIR$/YtManagerApp/management/jobs/synchronize.py" />
<option value="$PROJECT_DIR$/readme.md" />
</list>
</option>
</component>
@ -626,20 +638,20 @@
<frame x="0" y="0" width="1920" height="1048" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.17697228" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.17697228" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" sideWeight="0.49520257" weight="0.38152173" />
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.52238804" weight="0.32717392" />
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.521855" visible="true" weight="0.32717392" />
<window_info anchor="bottom" id="Cvs" order="3" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="4" weight="0.4" />
<window_info active="true" anchor="bottom" id="Debug" order="5" sideWeight="0.49093816" visible="true" weight="0.37608695" />
<window_info anchor="bottom" id="Debug" order="5" sideWeight="0.49093816" weight="0.37608695" />
<window_info anchor="bottom" id="TODO" order="6" weight="0.329718" />
<window_info anchor="bottom" id="manage.py@youtube-channel-manager" order="7" sideWeight="0.49573562" weight="0.49347827" />
<window_info anchor="bottom" id="Docker" order="8" show_stripe_button="false" />
<window_info anchor="bottom" id="Database Changes" order="9" weight="0.3285968" />
<window_info anchor="bottom" id="Event Log" order="10" sideWeight="0.5090618" side_tool="true" visible="true" weight="0.37608695" />
<window_info anchor="bottom" id="Event Log" order="10" sideWeight="0.478145" side_tool="true" visible="true" weight="0.32717392" />
<window_info anchor="bottom" id="Version Control" order="11" sideWeight="0.49840087" weight="0.15326087" />
<window_info anchor="bottom" id="Terminal" order="12" sideWeight="0.49573562" weight="0.3576087" />
<window_info anchor="bottom" id="Python Console" order="13" sideWeight="0.49626866" weight="0.33804348" />
@ -682,22 +694,6 @@
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/YtManagerApp/management/jobs/synchronize.py</url>
<line>31</line>
<option name="timeStamp" value="2" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/external/pytaw/pytaw/youtube.py</url>
<line>160</line>
<option name="timeStamp" value="3" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/YtManagerApp/views/controls/modal.py">
<provider selected="true" editor-type-id="text-editor">
@ -915,16 +911,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/readme.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor>
<caret column="2" selection-start-column="2" selection-end-column="2" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/YtManagerApp/templates/YtManagerApp/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="405">
@ -1006,16 +992,6 @@
<entry file="file://$PROJECT_DIR$/YtManagerApp/management/__init__.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/YtManagerApp/management/jobs/synchronize.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="31" column="33" selection-start-line="31" selection-start-column="33" selection-end-line="31" selection-end-column="33" />
<folding>
<element signature="e#0#12#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.PyCharm2018.2/system/python_stubs/-1247971763/itertools.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="182">
@ -1025,13 +1001,33 @@
</entry>
<entry file="file://$PROJECT_DIR$/external/pytaw/pytaw/youtube.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="429">
<caret line="171" column="32" selection-start-line="171" selection-start-column="32" selection-end-line="171" selection-end-column="32" />
<state relative-caret-position="-11204">
<caret line="163" column="29" selection-start-line="163" selection-start-column="29" selection-end-line="163" selection-end-column="29" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/YtManagerApp/management/jobs/synchronize.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="525">
<caret line="41" selection-start-line="41" selection-end-line="41" />
<folding>
<element signature="e#0#12#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/readme.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="330">
<caret line="22" column="15" lean-forward="true" selection-start-line="22" selection-start-column="15" selection-end-line="22" selection-end-column="15" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</component>
</project>

View File

@ -31,8 +31,12 @@ def __check_new_videos_sub(subscription: Subscription, yt_api: youtube.YoutubeAP
for yt_video in yt_api.videos(all_vids_ids, part='id,statistics'):
video = all_vids_dict.get(yt_video.id)
if yt_video.like_count is not None and yt_video.dislike_count is not None:
if yt_video.n_likes is not None \
and yt_video.n_dislikes is not None \
and yt_video.n_likes + yt_video.n_dislikes > 0:
video.rating = yt_video.n_likes / (yt_video.n_likes + yt_video.n_dislikes)
video.views = yt_video.n_views
video.save()

View File

@ -2,6 +2,24 @@
A self-hosted tool which manages your YouTube subscriptions, and downloads files automatically.
## Current state
Currently, the program will do what it's main job is to do: download videos, and keep track of the subscriptions.
Of course, there are a lot of things that still need to be done. The web interface is still pretty limited.
This is what still needs to be done:
* get status bar to actually display something (right now it's just a hardcoded message)
* add an indication of what the synchronization jobs are doing to the UI
* video page, which contains an embedded player
* OAuth YouTube authentication, so private playlists can be obtained
* Web UI improvements:
* Paging for videos
* Handle drag & drop for the subscription folders
* Update UI when something changes
* Improve stability
* Bonus: Plex integration
## Dependencies
* python3: `$ apt install python3`