mirror of
https://github.com/FakeTV/pseudo-channel.git
synced 2025-12-15 07:43:44 +00:00
@@ -73,12 +73,13 @@ select strict_time_entry in "Exact Time" "After Previous"
|
|||||||
echo "5, 10, 15, 20, etc. after the hour. A value of 30 will only allow the $entry to"
|
echo "5, 10, 15, 20, etc. after the hour. A value of 30 will only allow the $entry to"
|
||||||
echo "start on the half-hour. A value of 2 will restrict start times to even-numbered minutes only."
|
echo "start on the half-hour. A value of 2 will restrict start times to even-numbered minutes only."
|
||||||
echo "ENTER the TIME SHIFT value"
|
echo "ENTER the TIME SHIFT value"
|
||||||
read -p 'Time Shift: ' time_shift
|
read -p 'Time Shift: ' time_shift_entry
|
||||||
while ! [[ $time_shift =~ $re ]]
|
time_shift="\"$time_shift_entry\""
|
||||||
|
while ! [[ $time_shift_entry =~ $re ]]
|
||||||
do
|
do
|
||||||
echo "ENTER the TIME SHIFT value"
|
echo "ENTER the TIME SHIFT value"
|
||||||
read -p 'Time Shift: ' time_shift
|
read -p 'Time Shift: ' time_shift_entry
|
||||||
time_shift="\"$time_shift\""
|
time_shift="\"$time_shift_entry\""
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
@@ -555,6 +556,7 @@ select day_of_week in "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday
|
|||||||
then
|
then
|
||||||
echo "FINALIZING SCHEDULE FORMATTING..."
|
echo "FINALIZING SCHEDULE FORMATTING..."
|
||||||
echo "</schedule>" >> pseudo_schedule.xml
|
echo "</schedule>" >> pseudo_schedule.xml
|
||||||
|
sudo python PseudoChannel.py -xml
|
||||||
echo "CLEANING UP TEMPORARY FILES"
|
echo "CLEANING UP TEMPORARY FILES"
|
||||||
sudo rm xtra.temp
|
sudo rm xtra.temp
|
||||||
echo "REMOVE BACKUP of Channel $channel_number's previous schedule?"
|
echo "REMOVE BACKUP of Channel $channel_number's previous schedule?"
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# ./update-channels-from-git.sh
|
# ./update-channels-from-git.sh
|
||||||
#----
|
#----
|
||||||
|
|
||||||
|
dir=$(pwd)
|
||||||
#----BEGIN EDITABLE VARS----
|
#----BEGIN EDITABLE VARS----
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
echo "ERROR: Please only supply one argument"
|
echo "ERROR: Please only supply one argument"
|
||||||
@@ -92,13 +93,20 @@ read -p 'Number of Channels: ' number_of_channels
|
|||||||
mkdir "pseudo-channel_$num"
|
mkdir "pseudo-channel_$num"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
mkdir github_download
|
||||||
|
cd github_download
|
||||||
|
$SCRIPT_TO_EXECUTE_PLUS_ARGS
|
||||||
|
else
|
||||||
|
mkdir github_download
|
||||||
|
cd github_download
|
||||||
|
$SCRIPT_TO_EXECUTE_PLUS_ARGS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
#### Next, let's download the latest master version of information from GitHub and store it in a temporary folder
|
#### Next, let's download the latest master version of information from GitHub and store it in a temporary folder
|
||||||
mkdir github_download
|
#mkdir github_download
|
||||||
cd github_download
|
#cd github_download
|
||||||
$SCRIPT_TO_EXECUTE_PLUS_ARGS
|
#$SCRIPT_TO_EXECUTE_PLUS_ARGS
|
||||||
|
|
||||||
#### If necessary, install the required elements as defined by requirements.txt
|
#### If necessary, install the required elements as defined by requirements.txt
|
||||||
#### Also, ask user for information to fill in the plex_token and pseudo_config files
|
#### Also, ask user for information to fill in the plex_token and pseudo_config files
|
||||||
@@ -187,11 +195,11 @@ if [ "$FIRST_INSTALL" == "true" ]
|
|||||||
done
|
done
|
||||||
if [[ "$enter_commercials" == @("Y"|"y"|"yes"|"Yes"|"YES") ]]
|
if [[ "$enter_commercials" == @("Y"|"y"|"yes"|"Yes"|"YES") ]]
|
||||||
then
|
then
|
||||||
commercials_true=true
|
commercials_true=True
|
||||||
echo "ENTER the name of EACH Plex library defined as COMMERCIALS"
|
echo "ENTER the name of EACH Plex library defined as COMMERCIALS"
|
||||||
echo -n "[" > commercial-libraries.temp
|
echo -n "[" > commercial-libraries.temp
|
||||||
else
|
else
|
||||||
commercials_true=false
|
commercials_true=False
|
||||||
fi
|
fi
|
||||||
while [[ "$enter_commercials" == @(Y|y|Yes|yes|YES) ]]
|
while [[ "$enter_commercials" == @(Y|y|Yes|yes|YES) ]]
|
||||||
do
|
do
|
||||||
@@ -205,7 +213,7 @@ if [ "$FIRST_INSTALL" == "true" ]
|
|||||||
read -p 'Y/N: ' enter_commercials
|
read -p 'Y/N: ' enter_commercials
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
if [[ "$commercials_true" == "true" ]]
|
if [[ "$commercials_true" == "True" ]]
|
||||||
then
|
then
|
||||||
truncate -s-2 commercial-libraries.temp
|
truncate -s-2 commercial-libraries.temp
|
||||||
echo -n "]," >> commercial-libraries.temp
|
echo -n "]," >> commercial-libraries.temp
|
||||||
@@ -233,7 +241,7 @@ if [ "$FIRST_INSTALL" == "true" ]
|
|||||||
sudo sed -i "/.\"TV Shows\" :*./c\ \"TV Shows\" : $tv_libraries" github_download/both-dir/pseudo_config.py # WRITE TV LIBRARIES TO CONFIG
|
sudo sed -i "/.\"TV Shows\" :*./c\ \"TV Shows\" : $tv_libraries" github_download/both-dir/pseudo_config.py # WRITE TV LIBRARIES TO CONFIG
|
||||||
movie_libraries=$(cat movie-libraries.temp)
|
movie_libraries=$(cat movie-libraries.temp)
|
||||||
sudo sed -i "/.\"Movies\" :*./c\ \"Movies\" : $movie_libraries" github_download/both-dir/pseudo_config.py # WRITE MOVIE LIBRARIES TO CONFIG
|
sudo sed -i "/.\"Movies\" :*./c\ \"Movies\" : $movie_libraries" github_download/both-dir/pseudo_config.py # WRITE MOVIE LIBRARIES TO CONFIG
|
||||||
if [[ "$commercials_true" == "true" ]] #WRITE COMMERCIAL LIBRARIES TO CONFIG
|
if [[ "$commercials_true" == "True" ]] #WRITE COMMERCIAL LIBRARIES TO CONFIG
|
||||||
then
|
then
|
||||||
commercial_libraries=$(cat commercial-libraries.temp)
|
commercial_libraries=$(cat commercial-libraries.temp)
|
||||||
sudo sed -i "/.\"Commercials\" :*./c\ \"Commercials\" : $commercial_libraries" github_download/both-dir/pseudo_config.py
|
sudo sed -i "/.\"Commercials\" :*./c\ \"Commercials\" : $commercial_libraries" github_download/both-dir/pseudo_config.py
|
||||||
@@ -249,6 +257,8 @@ if [ "$FIRST_INSTALL" == "true" ]
|
|||||||
sudo rm tv-libraries.temp
|
sudo rm tv-libraries.temp
|
||||||
sudo rm commercial-libraries.temp
|
sudo rm commercial-libraries.temp
|
||||||
sudo cp github_download/both-dir/pseudo_config.py ./
|
sudo cp github_download/both-dir/pseudo_config.py ./
|
||||||
|
sudo cp github_download/both-dir/PseudoChannel.py ./
|
||||||
|
cd ..
|
||||||
else
|
else
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
@@ -305,7 +315,7 @@ fi
|
|||||||
#### - Copy relevant files from github
|
#### - Copy relevant files from github
|
||||||
#### - Replace files originally removed
|
#### - Replace files originally removed
|
||||||
echo "Updating channels folder"
|
echo "Updating channels folder"
|
||||||
|
cd $dir
|
||||||
# Export critical files
|
# Export critical files
|
||||||
mkdir .pseudo-temp
|
mkdir .pseudo-temp
|
||||||
|
|
||||||
@@ -338,6 +348,7 @@ sudo chmod -R 777 .
|
|||||||
echo "Update Complete"
|
echo "Update Complete"
|
||||||
|
|
||||||
#### Write variables to config.cache
|
#### Write variables to config.cache
|
||||||
|
> config.cache
|
||||||
sudo sed -i "s/server_ip=.*/server_ip=$server_ip/" config.cache
|
sudo sed -i "s/server_ip=.*/server_ip=$server_ip/" config.cache
|
||||||
sudo sed -i "s/server_port=.*/server_port=$server_port/" config.cache
|
sudo sed -i "s/server_port=.*/server_port=$server_port/" config.cache
|
||||||
sudo sed -i "s/server_token=.*/server_token=$server_token/" config.cache
|
sudo sed -i "s/server_token=.*/server_token=$server_token/" config.cache
|
||||||
|
|||||||
75
updatexml.sh
Normal file
75
updatexml.sh
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# file: updatechannels.sh
|
||||||
|
|
||||||
|
#----
|
||||||
|
# Simple script to updates each channels local db with new Plex lib items / xml.
|
||||||
|
#----
|
||||||
|
|
||||||
|
#----
|
||||||
|
# To Use:
|
||||||
|
# If you added new content to your Plex Library, just make this file executable move it
|
||||||
|
# to where the plex_token.py file is and run ./updatechannels.sh
|
||||||
|
#----
|
||||||
|
|
||||||
|
# Make sure that each channel dir ends with a "_" + an incrementing number as seen above.
|
||||||
|
|
||||||
|
#----BEGIN EDITABLE VARS----
|
||||||
|
|
||||||
|
SCRIPT_TO_EXECUTE_PLUS_ARGS='PseudoChannel.py -xml'
|
||||||
|
|
||||||
|
OUTPUT_PREV_CHANNEL_PATH=.
|
||||||
|
|
||||||
|
CHANNEL_DIR_INCREMENT_SYMBOL="_"
|
||||||
|
|
||||||
|
PYTHON_TO_USE="$(which python)"
|
||||||
|
|
||||||
|
# If using 'virtualenv' with python, specify the local virtualenv dir.
|
||||||
|
VIRTUAL_ENV_DIR="env"
|
||||||
|
|
||||||
|
#----END EDITABLE VARS-------
|
||||||
|
|
||||||
|
# If virtualenv specified & exists, using that version of python instead.
|
||||||
|
if [ -d "$VIRTUAL_ENV_DIR" ]; then
|
||||||
|
|
||||||
|
PYTHON_TO_USE="$VIRTUAL_ENV_DIR/bin/python"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If virtualenv specified & exists at root of project, using that version of python instead.
|
||||||
|
if [ -d "../$VIRTUAL_ENV_DIR" ]; then
|
||||||
|
|
||||||
|
PYTHON_TO_USE="../$VIRTUAL_ENV_DIR/bin/python"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If the file exists b
|
||||||
|
|
||||||
|
# Scan the dir to see how many channels there are, store them in an arr.
|
||||||
|
CHANNEL_DIR_ARR=( $(find . -maxdepth 1 -type d -name '*'"$CHANNEL_DIR_INCREMENT_SYMBOL"'[[:digit:]]*' -printf "%P\n" | sort -t"$CHANNEL_DIR_INCREMENT_SYMBOL" -n) )
|
||||||
|
|
||||||
|
# If this script see's there are multiple channels,
|
||||||
|
# then loop through each channel and run the updates
|
||||||
|
if [ "${#CHANNEL_DIR_ARR[@]}" -gt 0 ]; then
|
||||||
|
|
||||||
|
# If virtualenv specified & exists, using that version of python instead.
|
||||||
|
if [ -d "./$channel/$VIRTUAL_ENV_DIR" ]; then
|
||||||
|
|
||||||
|
PYTHON_TO_USE=./"$channel"/"$VIRTUAL_ENV_DIR/bin/python"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "+++++ There are ${#CHANNEL_DIR_ARR[@]} channels detected."
|
||||||
|
|
||||||
|
for channel in "${CHANNEL_DIR_ARR[@]}"
|
||||||
|
do
|
||||||
|
echo "+++++ Trying to update: $PYTHON_TO_USE $channel/$SCRIPT_TO_EXECUTE_PLUS_ARGS"
|
||||||
|
# If the running.pid file doesn't exists, create it, start PseudoChannel.py and add the PID to it.
|
||||||
|
cd "$channel"
|
||||||
|
"$PYTHON_TO_USE" $SCRIPT_TO_EXECUTE_PLUS_ARGS
|
||||||
|
cd ..
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user