Merge pull request #16 from mutto233/develop

Master update from Develop
This commit is contained in:
mutto233
2018-10-14 19:16:23 -04:00
committed by GitHub
3 changed files with 100 additions and 12 deletions

View File

@@ -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 "start on the half-hour. A value of 2 will restrict start times to even-numbered minutes only."
echo "ENTER the TIME SHIFT value"
read -p 'Time Shift: ' time_shift
while ! [[ $time_shift =~ $re ]]
read -p 'Time Shift: ' time_shift_entry
time_shift="\"$time_shift_entry\""
while ! [[ $time_shift_entry =~ $re ]]
do
echo "ENTER the TIME SHIFT value"
read -p 'Time Shift: ' time_shift
time_shift="\"$time_shift\""
read -p 'Time Shift: ' time_shift_entry
time_shift="\"$time_shift_entry\""
done
fi
break
@@ -555,6 +556,7 @@ select day_of_week in "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday
then
echo "FINALIZING SCHEDULE FORMATTING..."
echo "</schedule>" >> pseudo_schedule.xml
sudo python PseudoChannel.py -xml
echo "CLEANING UP TEMPORARY FILES"
sudo rm xtra.temp
echo "REMOVE BACKUP of Channel $channel_number's previous schedule?"

View File

@@ -14,6 +14,7 @@
# ./update-channels-from-git.sh
#----
dir=$(pwd)
#----BEGIN EDITABLE VARS----
if [ $# -gt 1 ]; then
echo "ERROR: Please only supply one argument"
@@ -92,13 +93,20 @@ read -p 'Number of Channels: ' number_of_channels
mkdir "pseudo-channel_$num"
fi
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
#### Next, let's download the latest master version of information from GitHub and store it in a temporary folder
mkdir github_download
cd github_download
$SCRIPT_TO_EXECUTE_PLUS_ARGS
#mkdir github_download
#cd github_download
#$SCRIPT_TO_EXECUTE_PLUS_ARGS
#### 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
@@ -187,11 +195,11 @@ if [ "$FIRST_INSTALL" == "true" ]
done
if [[ "$enter_commercials" == @("Y"|"y"|"yes"|"Yes"|"YES") ]]
then
commercials_true=true
commercials_true=True
echo "ENTER the name of EACH Plex library defined as COMMERCIALS"
echo -n "[" > commercial-libraries.temp
else
commercials_true=false
commercials_true=False
fi
while [[ "$enter_commercials" == @(Y|y|Yes|yes|YES) ]]
do
@@ -205,7 +213,7 @@ if [ "$FIRST_INSTALL" == "true" ]
read -p 'Y/N: ' enter_commercials
done
done
if [[ "$commercials_true" == "true" ]]
if [[ "$commercials_true" == "True" ]]
then
truncate -s-2 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
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
if [[ "$commercials_true" == "true" ]] #WRITE COMMERCIAL LIBRARIES TO CONFIG
if [[ "$commercials_true" == "True" ]] #WRITE COMMERCIAL LIBRARIES TO CONFIG
then
commercial_libraries=$(cat commercial-libraries.temp)
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 commercial-libraries.temp
sudo cp github_download/both-dir/pseudo_config.py ./
sudo cp github_download/both-dir/PseudoChannel.py ./
cd ..
else
cd ..
fi
@@ -305,7 +315,7 @@ fi
#### - Copy relevant files from github
#### - Replace files originally removed
echo "Updating channels folder"
cd $dir
# Export critical files
mkdir .pseudo-temp
@@ -338,6 +348,7 @@ sudo chmod -R 777 .
echo "Update Complete"
#### Write variables to config.cache
> 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_token=.*/server_token=$server_token/" config.cache

75
updatexml.sh Normal file
View 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