Skip to content

Commit d3553c1

Browse files
version 1.2
1 parent e57b79f commit d3553c1

File tree

3 files changed

+29
-23
lines changed

3 files changed

+29
-23
lines changed

Documents/changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ Version control history:
44
* Version 1.1-1 OCT 2019
55
* First version
66

7+
* Version 1.2-2 Nov 2019
8+
* Small Patch so script work with windows 10 powershell due to ANSI escapes sequences not working in windows shell
9+
710

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ Where tag default = youtube, A custom tag can be added using -t option.
3636
Usage
3737
--------
3838

39-
NOTE: Currently only works on Linux.
40-
4139
1. Download the python program, opml_convert_rss.py.
4240
2. In a web browser navigate to subscription manager page of youtube.
4341
https://www.youtube.com/subscription_manager
@@ -74,3 +72,4 @@ optional arguments:
7472
* -o OUTFILE output filename and/or full path, default ./outfile.txt
7573
* -t TAGNAME tagname, default = youtube
7674

75+
NOTE: Works in windows powershell but without Colour text

code/opml_convert_rss.py

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# opml sub file into text file for rss reader newsboat.
77
# author : Gavin Lyons
88
# date : OCT 2019
9-
# version : 1.1
9+
# version : 1.2
1010
# web : See __URL__
1111
1212
# python_version : 3.6.8
@@ -15,10 +15,11 @@
1515
# Import the system modules needed to run
1616
from xml.etree import ElementTree
1717
import argparse
18+
from sys import platform
1819

1920
# =============Functions==============
2021
# metadata
21-
__VERSION__ = "1.1"
22+
__VERSION__ = "1.2"
2223
__URL__ = "https://github.com/gavinlyonsrepo/opml_convert_RSS"
2324

2425

@@ -103,29 +104,32 @@ def process_cmd_arguments():
103104
def msg_func(myprocess, mytext):
104105
"""NAME : msg_func
105106
DESCRIPTION :prints to screen
106-
prints line, text and anykey prompts,
107+
prints line, text.
107108
INPUTS : $1 process name $2 text input
108109
PROCESS :[1] print line
109110
[2] print text "green , red ,blue "
111+
NOTE: only works for linux , for windows just prints text as asni escape codes
112+
did not work in powershell
110113
"""
111-
112-
# colours for print
113-
blue = '\033[94m'
114-
red = '\033[91m'
115-
bold = '\033[1m'
116-
end = '\033[0m'
117-
118-
if myprocess == "line": # print blue horizontal line of =
119-
print(blue + "="*80 + end)
120-
121-
if myprocess == "red": # print red text
122-
print(red + mytext + end)
123-
124-
if myprocess == "blue": # print blue text
125-
print(blue + mytext + end)
126-
127-
if myprocess == "bold": # print bold text
128-
print(bold + mytext + end)
114+
if platform == 'win32':
115+
print(mytext)
116+
else:
117+
# colours for print
118+
blue = '\033[94m'
119+
red = '\033[91m'
120+
bold = '\033[1m'
121+
end = '\033[0m'
122+
if myprocess == "line": # print blue horizontal line of =
123+
print(blue + "="*80 + end)
124+
125+
if myprocess == "red": # print red text
126+
print(red + mytext + end)
127+
128+
if myprocess == "blue": # print blue text
129+
print(blue + mytext + end)
130+
131+
if myprocess == "bold": # print bold text
132+
print(bold + mytext + end)
129133

130134

131135
# =====================MAIN===============================

0 commit comments

Comments
 (0)