Skip to content
This repository was archived by the owner on Mar 21, 2023. It is now read-only.

Commit 42f6496

Browse files
Merge branch 'master' of github.com:iamtalhaasghar/yewtube
2 parents a072c22 + d768571 commit 42f6496

File tree

3 files changed

+48
-16
lines changed

3 files changed

+48
-16
lines changed

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
include mps-youtube.desktop
22
include LICENSE
3-
include README.rst
4-
include CHANGELOG
3+
include README.md
4+
include CHANGELOG.md

mps_youtube/helptext.py

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
"""
22
Holds all help text
33
"""
4-
from . import c, g
5-
from .util import get_near_name, F
6-
from urllib.request import urlopen
4+
import pathlib
5+
import re
6+
import socket
77
from urllib.error import HTTPError, URLError
8-
import socket, re
8+
from urllib.request import urlopen
9+
10+
from . import c, g
11+
from .util import F, get_near_name
12+
913

1014
def helptext():
1115
""" Return a list of help categories, with their contents. """
@@ -27,8 +31,8 @@ def helptext():
2731
{2}d <number>{1} - download video <number>
2832
{2}r <number>{1} - show videos related to video <number>
2933
{2}u <number>{1} - show videos uploaded by uploader of video <number>
30-
{2}x <number>{1} - copy item <number> url to clipboard. (See the note below)
31-
Note: This feature requires `pyperclip` which is installed automatically when you install yewtube but
34+
{2}x <number>{1} - copy item <number> url to clipboard. (See the note below)
35+
Note: This feature requires `pyperclip` which is installed automatically when you install yewtube but
3236
Linux users further need to install `xsel` or `xclip` manually using apt, dnf, pacman, zypper or whatever package manager you use.
3337
Visit https://pyperclip.readthedocs.io/en/latest/index.html#not-implemented-error for more info.
3438
@@ -56,15 +60,15 @@ def helptext():
5660
5761
{2}album <album title>{1} - Search for matching tracks using album title
5862
{2}channels <Channel name>{1} - Search for channels by channelname
59-
{2}live <category>{1} - Search for livestreams from a range of categories.
63+
{2}live <category>{1} - Search for livestreams from a range of categories.
6064
Categories: {2}{3}{1}
6165
6266
{2}mkp <fullfilepath>{1} - Creates a playlist automatically with video titles from fullfilepath
6367
<fullfilepath>: Full path of text file with one title per line
64-
68+
6569
{2}mkp -d <search result number>{1} - Create a playlist based on tracks
6670
listed in that videos description. (Alternatively one can use {2}--description{1})
67-
71+
6872
{2}user <username>{1} - list YouTube uploads by <username>.
6973
{2}user <username>/<query>{1} - as above, but matches <query>.
7074
{2}userpl <username>{1} - list YouTube playlists created by <username>.
@@ -249,7 +253,7 @@ def helptext():
249253
{2}set history true|false{1} - record play history
250254
{2}set input_history true|false{1} - record command input history
251255
{2}set vlc_dummy_interface true|false{1} - whether to hide VLC GUI or not (hides when true)
252-
256+
253257
Additionally, {2}set -t{1} may be used to temporarily change a setting without
254258
saving it to disk
255259
""".format(c.ul, c.w, c.y, '\n{0}set max_results <number>{1} - show <number> re'
@@ -304,9 +308,26 @@ def helptext():
304308
command
305309
306310
Use {2}clearcache{1} command to clear the cache.
307-
""".format(c.ul, c.w, c.y)),
308-
("new", "Check if new version is available", """{0}What's New{1}\n{3}""".format(c.ul, c.w, c.y, "get_changelog()")),
309-
("tor", "Check Tor Status. NOTE: Use this feature at your own risk. In case of any kind of damage we will not be responsible.", """{0}Tor Status{1}\n{3}""".format(c.ul, c.w, c.y, "check_tor()"))]
311+
""".format(
312+
c.ul, c.w, c.y
313+
),
314+
),
315+
(
316+
"new",
317+
"Check if new version is available",
318+
"""{0}What's New{1}\n{3}""".format(c.ul, c.w, c.y, "get_changelog()"),
319+
),
320+
(
321+
"changelog",
322+
"Check program changelog",
323+
"""{0}Changelog{1}\n{3}""".format(c.ul, c.w, c.y, "get_changelog_local()"),
324+
),
325+
(
326+
"tor",
327+
"Check Tor Status. NOTE: Use this feature at your own risk. In case of any kind of damage we will not be responsible.",
328+
"""{0}Tor Status{1}\n{3}""".format(c.ul, c.w, c.y, "check_tor()"),
329+
),
330+
]
310331

311332

312333
def get_help(choice):
@@ -376,6 +397,8 @@ def indent(x):
376397
output_text = check_tor()
377398
elif choice == 'new':
378399
output_text = get_changelog()
400+
elif choice == "changelog":
401+
output_text = get_changelog_local()
379402
else:
380403
choice = help_names.index(choice)
381404
output_text = all_help[choice][2]
@@ -391,6 +414,15 @@ def get_changelog():
391414
except (URLError, HTTPError, socket.timeout):
392415
return "read changelog timed out"
393416

417+
418+
def get_changelog_local():
419+
cl_path = pathlib.Path(__file__).parent.parent / "CHANGELOG.md"
420+
if cl_path.is_file():
421+
return "\n".join(reversed(cl_path.read_text().splitlines()))
422+
else:
423+
return "can't find changelog file"
424+
425+
394426
def check_tor():
395427
try:
396428
url = "https://check.torproject.org/?lang=en"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"bundle_files": 1
7676
}
7777
},
78-
package_data={"": ["LICENSE", "README.md", "CHANGELOG"]},
78+
package_data={"": ["LICENSE", "README.md", "CHANGELOG.md"]},
7979
long_description_content_type='text/markdown',
8080
long_description=long_description
8181
)

0 commit comments

Comments
 (0)