Skip to content

Commit

Permalink
Merge pull request MundeepL#2 from klte-hype/master
Browse files Browse the repository at this point in the history
Fixed some of the scripts
  • Loading branch information
MundeepL authored Jan 5, 2025
2 parents 9bfea19 + 55f6cbc commit cfc4da9
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 48 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ git clone https://github.com/mundeepl/PiFM
```
This will download the software from this repository
```
chmod +x /home/pi/PiFM/setup-pi4.sh
chmod +x ~/PiFM/setup-pi4.sh
```
This changes the permissions to allow you to run the setup
```
Expand All @@ -71,11 +71,11 @@ sudo apt-get install git -y
```
This will install git, which allows you to download files from Github
```
git clone https://github.com/mundeepl/PiFM
git clone https://github.com/redmi4a-hype/PiFM
```
This will download the software from this repository
```
chmod +x /home/pi/PiFM/setup.sh
chmod +x ~/PiFM/setup.sh
```
This changes the permissions to allow you to run the setup
```
Expand Down Expand Up @@ -108,7 +108,7 @@ If at any point you wish to close the broadcast, make the terminal window active
## Advanced Users (those confident with a terminal)
You can also use PiFM using the terminal
```
cd /home/pi/PiFM/src
cd ~/PiFM/src
sudo ./PiFM
```
This will generate an FM transmission on 87.6Mhz, with default station name (PS), radiotext (RT) and PI-code (PI), without audio. The radio frequency signal is emitted on GPIO 4 (pin 7 on header P1).
Expand Down
8 changes: 4 additions & 4 deletions pifm-basic.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash

# This is a small script created by Mundeep Lamport as an alternative
# This is a small script created by MundeepL as an alternative
# to the GUI interface of PiFM, which is an FM transmitter app


# Initialising and opening the install script by clearing the terminal to make install clutter-free
# Initialising and opening the install script by clearing the terminal to make the installation clutter-free
clear
echo " "
echo "██████╗ ██╗ ███████╗███╗ ███╗ ██╗ ██████╗"
Expand Down Expand Up @@ -33,7 +33,7 @@ echo "allowing you to start transmitting with just a few bits of key, user-custo
sleep 5
clear

# Choosing transmission options by reading in vaariable values
# Choosing transmission options by reading in variable values
# Choose Frequency
echo "Which frequency would you like to use? (85.5-108)"
read frequency
Expand Down Expand Up @@ -120,5 +120,5 @@ echo -ne '\n'


# starting the PiFM software with the chosen variable flags
cd /home/pi/PiFM/src
cd $HOME/PiFM/src
sudo ./pifm --freq $frequency --ps $ps --rt "$rt" --audio $audio --pi $pi --pty $pty --mpx $mpx --power $power --preemph $pre
8 changes: 4 additions & 4 deletions pifm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ nameaccepted=0
textaccepted=0


# This is a small script created by Mundeep Lamport to streamline
# This is a small script created by MundeepL to streamline
# the process of running Pi FM RDS which is an FM transmitter tool.

clear
Expand Down Expand Up @@ -43,7 +43,7 @@ fi

# Choose the radio text (advanced)
until [ $textaccepted == 1 ] ; do
rt=$(zenity --title="PiFM by Mundeep Lamport" --entry --text="Choose the radio text (max. 64 characters)" --entry-text="Hello, World!" --width=500 --height=150 --ok-label="Continue" --cancel-label="Close")
rt=$(zenity --title="PiFM by MundeepL" --entry --text="Choose the radio text (max. 64 characters)" --entry-text="Hello, World!" --width=500 --height=150 --ok-label="Continue" --cancel-label="Close")
rtlength=${#rt}

if [[ $rtlength -ge 0 && $rtlength -le 64 ]] ; then
Expand Down Expand Up @@ -114,6 +114,6 @@ zenity --progress --title="PiFM by mundeepl" --percentage=0 --auto-close --auto-
echo "Completed. Starting service Pi FM RDS"

# Running Pi FM RDS
cd /home/pi/PiFM/src
cd $HOME/PiFM/src
sudo ./pifm --ps $ps --rt "$rt" --freq $frequency --audio $audio --preemph $region --pty $genre --power $power
zenity --title="PiFM by mundeepl" --info --text="Transmission ended. Thank you for using the PiFM Transmission software that was developed by mundeepl. If you would like to use more advanced settings, be sure to check out the README file in the /home/pi/PiFM directory. This will teach you further arguements and how to use the command line." --width=500 --height=150 --ok-label="Exit"
zenity --title="PiFM by mundeepl" --info --text="Transmission ended. Thank you for using the PiFM Transmission software that was developed by mundeepl. If you would like to use more advanced settings, be sure to check out the README file in the $HOME/PiFM directory. This will teach you further arguements and how to use the command line." --width=500 --height=150 --ok-label="Exit"
20 changes: 10 additions & 10 deletions setup-pi4.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash

# This is a setup script for the Pi FM RDS Transmitter project streamlined by Mundeep Lamport
# This is a setup script for the Pi FM RDS Transmitter project streamlined by MundeepL
clear
echo "Welcome to the PiFM installer. This script will help you get up and running."
echo "This script is designed specifically for the Raspberry Pi 4."
echo "For more information, visit https://github.com/mundeeplamport"
echo "For more information, visit https://github.com/mundeepl"
echo "WARNING! Your system will reboot once completed."
sleep 10
clear
Expand All @@ -15,7 +15,7 @@ echo "Installing required tools" ; sleep 1
sudo apt-get install libsndfile1-dev zenity git -y
clear
echo "Changing directory --> src" ; sleep 1
cd /home/pi/PiFM/src
cd $HOME/PiFM/src
clear
echo "Cleaning up" ; sleep 1
make clean
Expand All @@ -29,26 +29,26 @@ echo "Editing -> /boot/config.txt" ; sleep 1
echo "gpu_freq=250" | sudo tee -a /boot/config.txt > /dev/null
clear
echo "Adding software" ; sleep 1
cd /home/pi/PiFM
cd $HOME/PiFM
# Copy GUI Version
sudo cp /home/pi/PiFM/src/pi4/pifm.sh /usr/local/bin
sudo cp $HOME/PiFM/src/pi4/pifm.sh /usr/local/bin
sudo mv /usr/local/bin/pifm.sh /usr/local/bin/pifm
# Copy Basic Version
sudo cp /home/pi/PiFM/src/pi4/pifm-basic.sh /usr/local/bin
sudo cp $HOME/PiFM/src/pi4/pifm-basic.sh /usr/local/bin
sudo mv /usr/local/bin/pifm-basic.sh /usr/local/bin/pifm-basic
clear
echo "Creating shortcuts" ; sleep 1
sudo cp /home/pi/PiFM/src/pi4/PiFM.desktop /home/pi/Desktop
sudo cp /home/pi/PiFM/src/pi4/PiFM.desktop /usr/share/applications
sudo cp $HOME/PiFM/src/pi4/PiFM.desktop $HOME/Desktop
sudo cp $HOME/PiFM/src/pi4/PiFM.desktop /usr/share/applications
echo "Changing filename/type" ; sleep 0.1
sudo mv /home/pi/PiFM/src/pi_fm_adv /home/pi/PiFM/src/pifm
sudo mv $HOME/PiFM/src/pi_fm_adv $HOME/PiFM/src/pifm
clear
echo "Patching xterm" ; sleep 0.1
cd /usr/bin
sudo cp lxterminal xterm
clear
echo "Assigning permissions" ; sleep 0.1
sudo chmod +x /home/pi/PiFM/pifm
sudo chmod +x $HOME/PiFM/pifm
sudo chmod +x /usr/local/bin/pifm
sudo chmod +x /usr/local/bin/pifm-basic
clear
Expand Down
16 changes: 8 additions & 8 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo "Installing required tools" ; sleep 1
sudo apt-get install libsndfile1-dev zenity -y
clear
echo "Changing directory --> src" ; sleep 1
cd /home/pi/PiFM/src
cd $HOME/PiFM/src
clear
echo "Cleaning up" ; sleep 1
make clean
Expand All @@ -27,26 +27,26 @@ echo "Making adjustments to --> /boot/config.txt" ; sleep 1
echo "gpu_freq=250" | sudo tee -a /boot/config.txt > /dev/null
clear
echo "Adding software" ; sleep 1
cd /home/pi/PiFM
cd $HOME/PiFM
# Copy GUI Version
sudo cp /home/pi/PiFM/pifm.sh /usr/local/bin
sudo cp $HOME/PiFM/pifm.sh /usr/local/bin
sudo mv /usr/local/bin/pifm.sh /usr/local/bin/pifm
# Copy Basic Version
sudo cp /home/pi/PiFM/pifm-basic.sh /usr/local/bin
sudo cp $HOME/PiFM/pifm-basic.sh /usr/local/bin
sudo mv /usr/local/bin/pifm-basic.sh /usr/local/bin/pifm-basic
clear
echo "Creating shortcuts" ; sleep 1
sudo cp /home/pi/PiFM/src/PiFM.desktop /home/pi/Desktop
sudo cp /home/pi/PiFM/src/PiFM.desktop /usr/share/applications
sudo cp $HOME/PiFM/src/PiFM.desktop $HOME/Desktop
sudo cp $HOME/PiFM/src/PiFM.desktop /usr/share/applications
echo "Changing filename/type" ; sleep 1
sudo mv /home/pi/PiFM/src/pi_fm_adv /home/pi/PiFM/src/pifm
sudo mv $HOME/PiFM/src/pi_fm_adv $HOME/PiFM/src/pifm
clear
echo "Patching xterm" ; sleep 1
cd /usr/bin
sudo cp lxterminal xterm
clear
echo "Assigning permissions" ; sleep 1
sudo chmod +x /home/pi/PiFM/pifm
sudo chmod +x $HOME/PiFM/pifm
sudo chmod +x /usr/local/bin/pifm
sudo chmod +x /usr/local/bin/pifm-basic
clear
Expand Down
5 changes: 2 additions & 3 deletions src/pi4/PiFM.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ Version=1.0
Name=PiFM
Comment=Broadcast from your Raspberry Pi!
GenericName=FM Transmitter
Icon=/home/pi/PiFM/src/PiFM.png
Icon=$HOME/PiFM/src/PiFM.png
Terminal=true
Type=Application
Exec= /home/pi/PiFM/src/pi4/pifm.sh

Exec= $HOME/PiFM/src/pi4/pifm.sh
6 changes: 3 additions & 3 deletions src/pi4/pifm-basic.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# This is a small script created by Mundeep Lamport as an alternative
# This is a small script created by MundeepL as an alternative
# to the GUI interface of PiFM, which is an FM transmitter app

clear
Expand All @@ -18,7 +18,7 @@ sleep 0.1
echo "╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚══════╝"
echo " "
sleep 1
echo "PiFM has been produced by Mundeep Lamport"
echo "PiFM has been produced by MundeepL"
sleep 5
clear
echo "Welcome to PiFM. An FM-RDS capable transmitter."
Expand Down Expand Up @@ -112,5 +112,5 @@ echo -ne '[]####################[] (100%)\r'
sleep 1
echo -ne 'Completed. Starting service Pi FM. \r'
echo -ne '\n'
cd /home/pi/PiFM/src
cd $HOME/PiFM/src
sudo ./pifm --freq $frequency --ps $ps --rt "$rt" --audio $audio --pi $pi --pty $pty --mpx $mpx --power $power --preemph $pre
24 changes: 12 additions & 12 deletions src/pi4/pifm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ filecount=0
nameaccepted=0
textaccepted=0

# This is a small script created by Mundeep Lamport to streamline
# This is a small script created by MundeepL to streamline
# the process of running Pi FM RDS which is an FM transmitter tool.

clear
Expand All @@ -22,11 +22,11 @@ echo "╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚
echo " "

# Display about
zenity --title="PiFM by Mundeep Lamport" --info --text="Welcome to the Raspberry Pi FM Transmitter with RDS. This is a small applet designed by Mundeep Lamport to easily set up Pi FM RDS and is designed to make the process of broadcasting significantly easier. Please note that the software only decodes .wav or .ogg files." --width=500 --height=150 --ok-label="Begin"
zenity --title="PiFM by MundeepL" --info --text="Welcome to the Raspberry Pi FM Transmitter with RDS. This is a small applet designed by MundeepL to easily set up Pi FM RDS and is designed to make the process of broadcasting significantly easier. Please note that the software only decodes .wav or .ogg files." --width=500 --height=150 --ok-label="Begin"

# Choose a Program Service name (advanced)
until [ $nameaccepted == 1 ] ; do
ps=$(zenity --title="PiFM by Mundeep Lamport" --entry --text="Choose the Program Service Name (max. 8 characters)" --entry-text="PiFM" --width=500 --height=150 --ok-label="Continue" --cancel-label="Close")
ps=$(zenity --title="PiFM by MundeepL" --entry --text="Choose the Program Service Name (max. 8 characters)" --entry-text="PiFM" --width=500 --height=150 --ok-label="Continue" --cancel-label="Close")
pslength=${#ps}

if [[ $pslength -ge 0 && $pslength -le 8 ]] ; then
Expand All @@ -40,7 +40,7 @@ fi

# Choose the radio text (advanced)
until [ $textaccepted == 1 ] ; do
rt=$(zenity --title="PiFM by Mundeep Lamport" --entry --text="Choose the radio text (max. 64 characters)" --entry-text="Hello, World!" --width=500 --height=150 --ok-label="Continue" --cancel-label="Close")
rt=$(zenity --title="PiFM by MundeepL" --entry --text="Choose the radio text (max. 64 characters)" --entry-text="Hello, World!" --width=500 --height=150 --ok-label="Continue" --cancel-label="Close")
rtlength=${#rt}

if [[ $rtlength -ge 0 && $rtlength -le 64 ]] ; then
Expand All @@ -53,7 +53,7 @@ fi
done

# Choose a frequency
frequency=$(zenity --title="PiFM by Mundeep Lamport" --entry --text="Choose a frequency. (Pi 4 max. 93)" --entry-text="87.6" --width=500 --height=150 --ok-label="Continue" --cancel-label="Close")
frequency=$(zenity --title="PiFM by MundeepL" --entry --text="Choose a frequency. (Pi 4 max. 93)" --entry-text="87.6" --width=500 --height=150 --ok-label="Continue" --cancel-label="Close")
echo "The chosen frequency is $frequency MHz"

# Chooose an audio file (advanced)
Expand All @@ -74,19 +74,19 @@ esac


# Choose a region
region=$(zenity --list --title="PiFM by Mundeep Lamport" --text="Select current region" --radiolist --column "Pick" --column "PreEmph" --column "Region" TRUE us USA FALSE eu Europe FALSE eu Asia --ok-label="Continue" --cancel-label="Close")
region=$(zenity --list --title="PiFM by MundeepL" --text="Select current region" --radiolist --column "Pick" --column "PreEmph" --column "Region" TRUE us USA FALSE eu Europe FALSE eu Asia --ok-label="Continue" --cancel-label="Close")
echo "Region set to: $region"

# Choose the genre
genre=$(zenity --list --title="PiFM by Mundeep Lamport" --text="Select the broadcast genre" --radiolist --column "Pick" --column "Number" --column "Genre" TRUE 0 "Undefined" FALSE 1 "News" FALSE 2 "Current Affairs" FALSE 3 "Information" FALSE 4 "Sport" FALSE 5 "Education" FALSE 6 "Drama" FALSE 7 "Culture" FALSE 8 "Science" FALSE 9 "Varied" False 10 "Pop music" FALSE 11 "Rock music" FALSE 12 "Easy listening" FALSE 13 "Light Classical" FALSE 14 "Serious Classical" FALSE 15 "Other music" FALSE 16 "Weather" FALSE 17 "Finance" FALSE 18 "Children's programmes" FALSE 19 "Social affairs" FALSE 20 "Religion" FALSE 21 "Phone-in" FALSE 22 "Travel" FALSE 23 "Leisure" FALSE 24 "Jazz music" FALSE 25 "Country Music" FALSE 26 "National music" FALSE 27 "Oldies music" FALSE 28 "Folk music" FALSE 29 "Documentary" FALSE 30 "ALARM TEST" FALSE 31 "ALARM" --ok-label="Continue" --cancel-label="Close")
genre=$(zenity --list --title="PiFM by MundeepL" --text="Select the broadcast genre" --radiolist --column "Pick" --column "Number" --column "Genre" TRUE 0 "Undefined" FALSE 1 "News" FALSE 2 "Current Affairs" FALSE 3 "Information" FALSE 4 "Sport" FALSE 5 "Education" FALSE 6 "Drama" FALSE 7 "Culture" FALSE 8 "Science" FALSE 9 "Varied" False 10 "Pop music" FALSE 11 "Rock music" FALSE 12 "Easy listening" FALSE 13 "Light Classical" FALSE 14 "Serious Classical" FALSE 15 "Other music" FALSE 16 "Weather" FALSE 17 "Finance" FALSE 18 "Children's programmes" FALSE 19 "Social affairs" FALSE 20 "Religion" FALSE 21 "Phone-in" FALSE 22 "Travel" FALSE 23 "Leisure" FALSE 24 "Jazz music" FALSE 25 "Country Music" FALSE 26 "National music" FALSE 27 "Oldies music" FALSE 28 "Folk music" FALSE 29 "Documentary" FALSE 30 "ALARM TEST" FALSE 31 "ALARM" --ok-label="Continue" --cancel-label="Close")
echo "Program Type: $genre"

# Choose output power
power=$(zenity --list --title="PiFM by Mundeep Lamport" --radiolist --text="Select output power." --column "Pick" --column "Power" TRUE 1 FALSE 2 FALSE 3 FALSE 4 FALSE 5 FALSE 6 FALSE 7 --ok-label="Continue" --cancel-label="Close")
power=$(zenity --list --title="PiFM by MundeepL" --radiolist --text="Select output power." --column "Pick" --column "Power" TRUE 1 FALSE 2 FALSE 3 FALSE 4 FALSE 5 FALSE 6 FALSE 7 --ok-label="Continue" --cancel-label="Close")
echo "Power set to $power"

# End notice before starting
zenity --title="PiFM by Mundeep Lamport" --info --text="Now that you have chosen your options, it is time to begin transmitting. Ensure your antenna is inserted into GPIO 21 and then click start." --ok-label="Start" --width=500 --height=150
zenity --title="PiFM by MundeepL" --info --text="Now that you have chosen your options, it is time to begin transmitting. Ensure your antenna is inserted into GPIO 21 and then click start." --ok-label="Start" --width=500 --height=150

# Cool loading bar
(
Expand All @@ -106,11 +106,11 @@ echo "Finishing..." ; sleep 1
echo "Finished." ; sleep 0.5
echo "100"
) |
zenity --progress --title="PiFM by Mundeep Lamport" --percentage=0 --auto-close --auto-kill
zenity --progress --title="PiFM by MundeepL" --percentage=0 --auto-close --auto-kill
(( $? != 0 )) && zenity --error --title="PiFM Error" --text="Error! Could not complete!" --width=200 --height=100
echo "Completed. Starting service Pi FM RDS"

# Running Pi FM RDS
cd /home/pi/PiFM/src
cd $HOME/PiFM/src
sudo ./pifm --ps $ps --rt "$rt" --freq $frequency --audio $audio --preemph $region --pty $genre --power $power
zenity --title="PiFM by Mundeep Lamport" --info --text="Transmission ended. Thank you for using the PiFM Transmission software that was developed by Mundeep Lamport. If you would like to use more advanced settings, be sure to check out the README file in the /home/pi/PiFM directory. This will teach you further arguements and how to use the command line." --width=500 --height=150 --ok-label="Exit"
zenity --title="PiFM by MundeepL" --info --text="Transmission ended. Thank you for using the PiFM Transmission software that was developed by MundeepL. If you would like to use more advanced settings, be sure to check out the README file in the $HOME/PiFM directory. This will teach you further arguements and how to use the command line." --width=500 --height=150 --ok-label="Exit"

0 comments on commit cfc4da9

Please sign in to comment.