7 Commits

Author SHA1 Message Date
Jesus
a6ca011202 version v0.3.0 2025-03-08 16:28:39 -05:00
Jesus
114c2572a4 Renew plyr UI and simplify elements 2025-03-08 16:28:27 -05:00
f64b362603 update logic plyr-start.js 2025-03-03 08:20:41 +08:00
2fd7910194 version 0.2.21 2025-03-02 06:24:03 +08:00
c2e53072f7 update dependencies 2025-03-01 04:58:31 +08:00
c2986f3b14 Refactoring get_app_version 2025-03-01 04:06:11 +08:00
57854169f4 minor fix deprecation warning
tests/test_util.py: 14 warnings
  /home/runner/work/yt-local/youtube-local/youtube/util.py:321: DeprecationWarning: HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default).
    response.getheader('Content-Encoding', default='identity'))
2025-03-01 01:12:09 +08:00
8 changed files with 87 additions and 69 deletions

View File

@@ -1,21 +1,5 @@
blinker==1.7.0 # Include all production requirements
Brotli==1.1.0 -r requirements.txt
cachetools==5.3.3
click==8.1.7 # Development requirements
defusedxml==0.7.1 pytest>=6.2.1
Flask==3.0.2
gevent==24.2.1
greenlet==3.0.3
iniconfig==2.0.0
itsdangerous==2.1.2
Jinja2==3.1.4
MarkupSafe==2.1.5
packaging==24.0
pluggy==1.4.0
PySocks==1.7.1
pytest==8.1.1
stem==1.8.2
urllib3==2.2.2
Werkzeug==3.0.3
zope.event==5.0
zope.interface==6.2

View File

@@ -1,17 +1,8 @@
blinker==1.7.0 Flask>=1.0.3
Brotli==1.1.0 gevent>=1.2.2
cachetools==5.3.3 Brotli>=1.0.7
click==8.1.7 PySocks>=1.6.8
defusedxml==0.7.1 urllib3>=1.24.1
Flask==3.0.2 defusedxml>=0.5.0
gevent==24.2.1 cachetools>=4.0.0
greenlet==3.0.3 stem>=1.8.0
itsdangerous==2.1.2
Jinja2==3.1.4
MarkupSafe==2.1.5
PySocks==1.7.1
stem==1.8.2
urllib3==2.2.2
Werkzeug==3.0.3
zope.event==5.0
zope.interface==6.2

View File

@@ -121,7 +121,7 @@ def error_page(e):
elif (exc_info()[0] == util.FetchError elif (exc_info()[0] == util.FetchError
and exc_info()[1].code == '404' and exc_info()[1].code == '404'
): ):
error_message = ('Error: The page you are looking for isn\'t here. ¯\_(ツ)_/¯') error_message = ('Error: The page you are looking for isn\'t here.')
return flask.render_template('error.html', return flask.render_template('error.html',
error_code=exc_info()[1].code, error_code=exc_info()[1].code,
error_message=error_message, error_message=error_message,

View File

@@ -11,17 +11,10 @@ import subprocess
def app_version(): def app_version():
def minimal_env_cmd(cmd): def minimal_env_cmd(cmd):
# make minimal environment # make minimal environment
env = {} env = {k: os.environ[k] for k in ['SYSTEMROOT', 'PATH'] if k in os.environ}
for k in ['SYSTEMROOT', 'PATH']: env.update({'LANGUAGE': 'C', 'LANG': 'C', 'LC_ALL': 'C'})
v = os.environ.get(k)
if v is not None:
env[k] = v
env['LANGUAGE'] = 'C' out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
env['LANG'] = 'C'
env['LC_ALL'] = 'C'
out = subprocess.Popen(
cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
return out return out
subst_list = { subst_list = {
@@ -31,24 +24,21 @@ def app_version():
} }
if os.system("command -v git > /dev/null 2>&1") != 0: if os.system("command -v git > /dev/null 2>&1") != 0:
subst_list return subst_list
else:
if call(["git", "branch"], stderr=STDOUT,
stdout=open(os.devnull, 'w')) != 0:
subst_list
else:
# version
describe = minimal_env_cmd(["git", "describe", "--always"])
git_revision = describe.strip().decode('ascii')
# branch
branch = minimal_env_cmd(["git", "branch"])
git_branch = branch.strip().decode('ascii').replace('* ', '')
subst_list = { if call(["git", "branch"], stderr=STDOUT, stdout=open(os.devnull, 'w')) != 0:
"version": __version__, return subst_list
"branch": git_branch,
"commit": git_revision describe = minimal_env_cmd(["git", "describe", "--tags", "--always"])
} git_revision = describe.strip().decode('ascii')
branch = minimal_env_cmd(["git", "branch"])
git_branch = branch.strip().decode('ascii').replace('* ', '')
subst_list.update({
"branch": git_branch,
"commit": git_revision
})
return subst_list return subst_list

View File

@@ -58,7 +58,7 @@
}, },
}); });
const player = new Plyr(document.getElementById('js-video-player'), { const playerOptions = {
// Learning about autoplay permission https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/autoplay#syntax // Learning about autoplay permission https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/autoplay#syntax
autoplay: autoplayActive, autoplay: autoplayActive,
disableContextMenu: false, disableContextMenu: false,
@@ -117,5 +117,20 @@
tooltips: { tooltips: {
controls: true, controls: true,
}, },
}
const player = new Plyr(document.getElementById('js-video-player'), playerOptions);
// disable double click to fullscreen
// https://github.com/sampotts/plyr/issues/1370#issuecomment-528966795
player.eventListeners.forEach(function(eventListener) {
if(eventListener.type === 'dblclick') {
eventListener.element.removeEventListener(eventListener.type, eventListener.callback, eventListener.options);
}
}); });
// Add .started property, true after the playback has been started
// Needed so controls won't be hidden before playback has started
player.started = false;
player.once('playing', function(){this.started = true});
})(); })();

View File

@@ -37,3 +37,41 @@ e.g. Firefox playback speed options */
max-height: 320px; max-height: 320px;
overflow-y: auto; overflow-y: auto;
} }
/*
* Custom styles similar to youtube
*/
.plyr__controls {
display: flex;
justify-content: center;
}
.plyr__progress__container {
position: absolute;
bottom: 0;
width: 100%;
margin-bottom: -10px;
}
.plyr__controls .plyr__controls__item:first-child {
margin-left: 0;
margin-right: 0;
z-index: 5;
}
.plyr__controls .plyr__controls__item.plyr__volume {
margin-left: auto;
}
.plyr__controls .plyr__controls__item.plyr__progress__container {
padding-left: 10px;
padding-right: 10px;
}
.plyr__progress input[type="range"] {
margin-bottom: 50px;
}
/*
* End custom styles
*/

View File

@@ -318,7 +318,7 @@ def fetch_url(url, headers=(), timeout=15, report_text=None, data=None,
cleanup_func(response) # release_connection for urllib3 cleanup_func(response) # release_connection for urllib3
content = decode_content( content = decode_content(
content, content,
response.getheader('Content-Encoding', default='identity')) response.headers.get('Content-Encoding', default='identity'))
if (settings.debugging_save_responses if (settings.debugging_save_responses
and debug_name is not None and debug_name is not None

View File

@@ -1,3 +1,3 @@
from __future__ import unicode_literals from __future__ import unicode_literals
__version__ = '0.2.20' __version__ = 'v0.3.0'