mirror of
https://github.com/FakeTV/pseudo-channel.git
synced 2025-12-23 11:43:44 +00:00
Merge branch 'develop' of github.com:justinemter/pseudo-channel into develop
This commit is contained in:
11
README.md
11
README.md
@@ -55,14 +55,13 @@ You can run `% python PseudoChannel.py` with the following options. The order is
|
||||
|
||||
Features are being added to the xml but as of now there are a few. Within the XML `<time>` entry you are able to pass in various attributes to set certain values. As of now, aside from "title" and "type" which are mandatory, you can take advantage of "time-shift". This parameter accepts values in minutes and can be no lower than "1". If the attribute, "strict-time" is set to "false", then this `<time>` entry will be shifted to a new time based on the previous time with a smaller gap calculated according to the value in "time-shift". Basically, if you do not want any gaps in your daily generated schedule you would leave "strict-time" false and set "time-shift" to "1" for all `<time>` entries. However, this will create a schedule with weird start times like, "1:57 PM". Taking advantage of the "time-shift" perameter will correct this. If you set it to a value of "5", all media is shifted and hooked on to a "pretty" time that is a multiple of 5. So if used, rather then having a "Seinfeld" episode being set to "1:57 PM" it may be recalculated and scheduled for "2:00 PM". However, if you would like to make sure that "The Simpsons" will always start every weekday at "6:00 PM" then you can simply set that `<time>` entry to `srtict-time="true"`. This will ensure that despite other non-strict times shifting around, "The Simpsons" will air every weekday at the desired "6:00 PM" as scheduled (be sure that you haven't accidentally made two time entries "strict-time" for the same day/time - this sort of thing will cause weird scheduling errors). When using "strict-time" or having the "time-shift" value > than 1 (minute), this will result in empty gaps in the schedule. Currently I have a flag in the config for "commercial injection" to fill up the gaps as much as possible with commercials from commercials in your Plex server "Commercials" library. If you do not want to use this feature or if you don't have any commercials in your Plex server, just open up that `pseudo_config.py` file and set `useCommercialInjection` to `False`.
|
||||
|
||||
To run the app in a 'poor-mans-daemon-mode' using [screen](https://www.gnu.org/software/screen/manual/screen.html), run this:
|
||||
## Power Saving / Using an External Controller:
|
||||
|
||||
```bash
|
||||
% screen -d -m bash -c 'python PseudoChannel.py -r; exec sh'
|
||||
```
|
||||
[cli flag info](https://explainshell.com/explain?cmd=screen+-d+-m)
|
||||
*Warning: this section is useful only when getting the app working well manually. I highly recommend sticking with the manual methods of running PseudoChannel.py before attempting these features. It also helps to fully understand how the app works before implementing an external controller. You can better understand this app by tinkering with the methods above before attempting this part. When in doubt, just reach out to me here by creating an issue in this repo.*
|
||||
|
||||
...the previous command will keep the clock / app running in the background via the screen utility - kinda like a daemon process.
|
||||
If you'd like to use your PseudoChannel but do not want your media playing when you're not watching it, you have a handful of options to make the channel even cooler. When you run the app using `python PseudoChannel.py -r` it checks the `daily_schedule` that was generated for the day to see where the playhead is when you execute the app... if it happens to be `1:17 PM` when you run the app and "Seinfeld" started at `1:10 PM`, then the app will start playing the scheduled "Seinfeld" episode exactly 7 minutes in as it is scheduled for the day (down to the second). This is nice but what if you want to start / stop the app dynamically using a button hooked up to your Raspberry Pi? Or perhaps you'd like to setup a voice command using your Amazon Echo. All you have to do is trigger the `startstop.sh` bash file. So let's say you decided to use an IR Led reciever to catch commands sent by your TV remote. After you configure the IR circuit on your Raspberry Pi, you would set it to execute the `startstop.sh` file - this will then either start PseudoChannel.py & resume the daily schedule if it isn't already running, or stop the currently running PseudoChannel.py instance if it is running. Doing this will pick up the playhead exactly where it would be as if the app never stopped. However, if you decided to use PseudoChannel in this way you need to manually setup a crontab to trigger the daily update every night at `12:00 AM`. Since the app isn't running unless you trigger it, it needs to know to update the daily schedule and advance forward in the queue. To do this, there is another bash file named, `generate_daily_sched.sh`. This is the file that should be setup with crontab to be triggered every evening at midnight. Essentially, this file will check to see if the app has been started via, `startstop.sh` - if so it will do nothing as the running app will know to update when the clock hits midnight; if however, it finds that the `startstop.sh` script did not spawn an instance of the app, it will trigger, `python PseudoChannel.py -g` which will generate the daily schedule. It's important to note that you should only use the two bash scripts, `startstop.sh` & `generate_daily_sched.sh` with each other. If you have previously started the app using the command, `python PseudoChannel.py -r`, you should kill it before using the, `startstop.sh` or the `generate_daily_sched.sh`. So basically, if you decide to use this neat power-saving / dynamic controlling feature using the bash scripts, then stick with that. If you accidentally have an instance of the app running using `PseudoChannel.py` with the `-r` flag and also have the bash file setup with a crontab, you will unwittingly trigger the app to generate the daily schedule twice at the same time when the clock hits midnight. Before attempting any of this I recommend keeping it simple and just manually running the app. This will also help you easily view debug info incase you run into XML issues or other unforseen errs. Once everything seems to be running great, then move to this method.
|
||||
|
||||
## The Automatically Generated .HTML Daily Schedule / Server
|
||||
|
||||
To view the automatically generated "Daily Pseudo Schedule" index.html as seen in the image above, find it in the generated `./schedules/` directory within the project folder. The html file is generated both when the daily schedule is updated and whenever a media item from the schedule plays or ends (you can manually generate it with the `-m` flag).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user