diff --git a/README.md b/README.md index 25de9ab..2f14ad8 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,14 @@ Before you get this up and running there are two other things you need to do fir After getting these up and running there are some setup tasks to do. Rename config.py-default to config.py and open the file in a text editor. You need to add: 1) Your Twitter access tokens: You can find a good guide for doing this here - https://iag.me/socialmedia/how-to-create-a-twitter-app-in-8-easy-steps/ You will need to pick a unique name for the app. Which is annoying. Pick anything you want that isn't taken. Maybe add your name at the end. -2) Check where your pages will be saved to: Change the tti_path line too if you've changed your Teefax location. +2) Check where your pages will be saved to: Change the tti_path line too if you've changed your Teefax location. You can also customise the page number. 3) Change the colours if you want: Theme support is detailed below When you've setup your config.py you can run the script like this example that grabs your home timeline: `python3 teletext-twitter -t` (add -h to show options - also listed below) -The script will constantly update a spare page (153 - chosen because it used to be used for this purpose on Teefax in the past) in the main teletext folder (which defaults in VBIT2 to /home/pi/teletext/). +The script will constantly update your chosen page number (default is 153 - chosen because it used to be used for this purpose on Teefax in the past) in the main teletext folder (which defaults in VBIT2 to /home/pi/teletext/). All of the files in that folder are sent across to the TV every so often, therefore the script constantly overwrites it with new tweets (up to 5 - space permitting!) so that it will update on your screen. diff --git a/changelog.md b/changelog.md index 3bc91eb..b2961af 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ ## Changelog +### v0.5.3 +- Page number now user-customisable + ### v0.5.2 - Fixed stupid bug where I'd used %S instead of %M for the time display. now they're correct diff --git a/config.py-default b/config.py-default index c6c0625..e45e55f 100644 --- a/config.py-default +++ b/config.py-default @@ -21,3 +21,4 @@ timestamp_colour = "yellow" # miscellaneous tti_path = "/home/pi/teletext/" +page_number = 153 diff --git a/teletext-twitter/output.py b/teletext-twitter/output.py index 8569412..8ba3089 100644 --- a/teletext-twitter/output.py +++ b/teletext-twitter/output.py @@ -32,9 +32,9 @@ def write_tweet_line(file, line_num, line, config): def write_header(config): # write a header for the page and pop a nice banner at the top page_title = config["page_title"] logo_spacer = " " * (39 - (4 + len(page_title) + 5)) - with open(config["tti_path"] + "P153.tti", "w+") as file: + with open(config["tti_path"] + "P" + str(config["page_number"]) + ".tti", "w+") as file: file.write("DE,Autogenerated by Teletext-Twitter\r\n") - file.write("PN,15300\r\n") + file.write("PN," + str(config["page_number"]) + "00\r\n") file.write("SC,0000\r\n") file.write("PS,8000\r\n") file.write("OL,1," + ESCAPE + chr(text_colours[config["header_colour"]]) + SET_BACKGROUND + @@ -56,7 +56,7 @@ def write_timeline(twitter_object, config): # grab the latest timeline - only 5 if (line_position + len(tweet_text) + 1) > 24: # are we going to fill the page? break # yep! dump the last tweet! - with open(config["tti_path"] + "P153.tti", "a") as file: + with open(config["tti_path"] + "P" + str(config["page_number"]) + ".tti", "a") as file: write_tweet_info(file, line_position, tweet_username, tweet_human_time, config) line_position += 1 for line in tweet_text: @@ -77,7 +77,7 @@ def write_search_term(twitter_object, search_term, config): # search recent twee if (line_position + len(tweet_text) + 1) > 24: # are we going to fill the page? break # yep! dump the last tweet! - with open(config["tti_path"] + "P153.tti", "a") as file: + with open(config["tti_path"] + "P" + str(config["page_number"]) + ".tti", "a") as file: write_tweet_info(file, line_position, tweet_username, tweet_human_time, config) line_position += 1 for line in tweet_text: