diff --git a/crontab_file.txt b/crontab_file.txt
new file mode 100644
index 0000000..9710a3d
--- /dev/null
+++ b/crontab_file.txt
@@ -0,0 +1,25 @@
+# Edit this file to introduce tasks to be run by cron.
+#
+# Each task to run has to be defined through a single line
+# indicating with different fields when the task will be run
+# and what command to run for the task
+#
+# To define the time you can provide concrete values for
+# minute (m), hour (h), day of month (dom), month (mon),
+# and day of week (dow) or use '*' in these fields (for 'any').
+#
+# Notice that tasks will be started based on the cron's system
+# daemon's notion of time and timezones.
+#
+# Output of the crontab jobs (including errors) is sent through
+# email to the user the crontab file belongs to (unless redirected).
+#
+# For example, you can run a backup of all your user accounts
+# at 5 a.m every week with:
+# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
+#
+# For more information see the manual pages of crontab(5) and cron(8)
+#
+# m h dom mon dow command
+@reboot $HOME/update.sh >> $HOME/logfile.log
+@reboot sleep 10 && DISPLAY=:0 firefox --kiosk http://localhost:5000/display
diff --git a/display1.html b/display1.html
new file mode 100644
index 0000000..7383614
--- /dev/null
+++ b/display1.html
@@ -0,0 +1,112 @@
+
+
+
+
+ Now Playing
+
+
+
+
Now Playing
+
+
Nothing is playing
+
+
+ 0:00
+
+
+
+ 4:00
+
+
+
+
diff --git a/display2.html b/display2.html
new file mode 100644
index 0000000..37b78c7
--- /dev/null
+++ b/display2.html
@@ -0,0 +1,112 @@
+
+
+
+
+ Now Playing
+
+
+
+
+
Now Playing
+
+
Nothing is playing
+
+
+ 0:00
+
+
+
+ 4:00
+
+
+
+
+
diff --git a/htmltest.html b/htmltest.html
new file mode 100644
index 0000000..8fb1e77
--- /dev/null
+++ b/htmltest.html
@@ -0,0 +1,90 @@
+
+
+
+
+
+ Simple Music Player
+
+
+
+
+
+ Song Title
+
+
+ 0:00
+
+
+
+ 4:00
+
+
+
+
+
+
diff --git a/install.sh b/install.sh
new file mode 100644
index 0000000..c064550
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# Use /bin/bash to run this script, even when called manually
+
+SOURCE_DIR="$HOME/GR-Jukebox"
+TARGET_DIR="$HOME"
+
+for file in $SOURCE_DIR/*; do
+ filename=$(basename "$file")
+ if [ "$filename" != "install.sh" ]; then
+ # Move the file
+ cp -f "$file" "$TARGET_DIR/"
+
+ # Check if the file should be executable (modify this condition to fit your needs)
+ if [[ "$filename" == *.sh || "$filename" == *.py ]]; then
+ chmod +x "$TARGET_DIR/$filename"
+ fi
+ fi
+done
+
+crontab crontab_file.txt
+
+echo "Installation complete. All files have been moved to $TARGET_DIR."
diff --git a/main1.py b/main1.py
new file mode 100644
index 0000000..df6cf4b
--- /dev/null
+++ b/main1.py
@@ -0,0 +1,137 @@
+from flask import Flask, render_template, request, redirect, url_for, jsonify
+from flask_cors import CORS
+import yt_dlp
+import vlc
+import time
+import os
+import eyed3
+
+home_directory = os.path.expanduser("~")
+#app = Flask(__name__,template_folder=home_directory)
+app = Flask(__name__,template_folder=(home_directory+"/Code/GR/GR-Jukebox"))
+CORS(app, resources={r"/*": {"origins": "*"}})
+player = vlc.MediaPlayer()
+music_queue = []
+title_queue = []
+music_directory = os.path.expanduser('~/Music') # Adjust path as necessary
+
+@app.route('/')
+def index():
+ return render_template('manage1.html')
+
+@app.route('/display')
+def display():
+ return render_template('display1.html')
+
+@app.route('/music')
+def list_music():
+ music_files = []
+ for filename in os.listdir(music_directory):
+ if filename.endswith('.mp3'):
+ path = os.path.join(music_directory, filename)
+ audiofile = eyed3.load(path)
+ title = audiofile.tag.title if audiofile.tag else 'Unknown Title'
+ music_files.append({'id': filename.split('.')[0], 'title': title})
+ return jsonify(music_files)
+
+@app.route('/download', methods=['POST'])
+def download():
+ url = request.form['youtube_url']
+ if 'youtube.com' in url:
+ video_id = url.split('=')[1][:11] # Extract the video ID from the YouTube URL
+ elif 'youtu.be' in url:
+ video_id = url.split('youtu.be/')[1][:11]
+ else:
+ return jsonify({'status': 'error', 'message': 'Invalid YouTube URL'})
+ output_path = os.path.expanduser(f'{home_directory}/Music/{video_id}.mp3') # Path where the file will be saved
+
+ if not os.path.exists(output_path):
+ print("Downloading...")
+ # Configure yt-dlp to download best audio quality
+ ydl_opts = {
+ 'format': 'bestaudio/best',
+ 'postprocessors': [{
+ 'key': 'FFmpegExtractAudio',
+ 'preferredcodec': 'mp3',
+ 'preferredquality': '192',
+ }],
+ 'noplaylist': True,
+ 'quiet': True,
+ 'outtmpl': output_path[:-4] # Use the custom path as the output template
+ }
+
+ # Use yt-dlp to extract information and download the audio file
+ with yt_dlp.YoutubeDL(ydl_opts) as ydl:
+ info = ydl.extract_info(url, download=True)
+ title = info.get('title') # Extract the title from video information
+
+ # Load the downloaded file using eyed3 and add ID3 tags
+ audiofile = eyed3.load(output_path)
+ if audiofile.tag is None: # Create an ID3 tag if none exist
+ audiofile.tag = eyed3.id3.Tag()
+ audiofile.tag.file_info = eyed3.id3.FileInfo(output_path)
+
+ print(f"Downloaded: {title}")
+ audiofile.tag.title = title
+ audiofile.tag.save() # Save the metadata
+ #return redirect(url_for('index')) # Redirect back to the main page
+ return jsonify({'status': 'success', 'message': 'Song added successfully'})
+
+playing_thread = False
+@app.route('/play', methods=['POST'])
+def play():
+ global music_queue
+ global title_queue
+ global playing_thread
+ global player
+ music_queue.append(request.json['songId'])
+ title_queue.append(request.json['songTitle'])
+ if not playing_thread:
+ while len(music_queue) > 0:
+ playing_thread = True
+ player = vlc.MediaPlayer(f'{home_directory}/Music/{music_queue[0]}.mp3')
+ player.play()
+ # Wait for the audio to start playing and check periodically if it is still playing
+ time.sleep(1) # Short initial delay to allow playback to start
+ while player.is_playing():
+ print('Playing...')
+ time.sleep(0.5) # Check every second if it is still playing
+ player.stop()
+ music_queue.pop(0)
+ title_queue.pop(0)
+ playing_thread = False
+ return jsonify({'status': 'success', 'message': 'Playing song'})
+
+@app.route('/queue')
+def get_queue():
+ global title_queue
+ return jsonify([{'id': idx, 'title': title} for idx, title in enumerate(title_queue)])
+
+@app.route('/remove_from_queue', methods=['POST'])
+def remove_from_queue():
+ global music_queue
+ global title_queue
+ global player
+ data = request.json
+ song_id = int(data['songId'])
+ try:
+ #del music_queue[song_id]
+ #del title_queue[song_id]
+ if song_id == 0:
+ player.stop()
+ else:
+ music_queue.pop(song_id)
+ title_queue.pop(song_id)
+ return jsonify({'status': 'success', 'message': 'Song removed successfully'})
+ except IndexError:
+ return jsonify({'status': 'error', 'message': 'Invalid song ID'}), 400
+
+@app.route('/current')
+def current():
+ global title_queue
+ if len(title_queue) > 0:
+ return {'title': title_queue[0]}
+ return {'title': 'Nothing is playing'}
+
+if __name__ == "__main__":
+ app.run(host='0.0.0.0', debug=True, port=5000)
diff --git a/main2.py b/main2.py
new file mode 100644
index 0000000..ef88b68
--- /dev/null
+++ b/main2.py
@@ -0,0 +1,154 @@
+from flask import Flask, render_template, jsonify
+from flask_socketio import SocketIO, emit
+from flask_cors import CORS
+import yt_dlp
+import vlc
+import os
+import eyed3
+import time
+
+home_directory = os.path.expanduser("~")
+music_directory = os.path.expanduser('~/Music') # Adjust path as necessary
+
+#app = Flask(__name__,template_folder=home_directory)
+app = Flask(__name__, template_folder=f"{home_directory}/Code/GR/GR-Jukebox")
+CORS(app, resources={r"/*": {"origins": "*"}})
+socketio = SocketIO(app)
+player = vlc.MediaPlayer()
+music_queue = []
+title_queue = []
+
+@socketio.on('connect')
+def handle_connect():
+ emit('response', {'message': 'Connected to WebSocket server'})
+
+@socketio.on('list_music')
+def handle_list_music():
+ music_files = []
+ for filename in os.listdir(music_directory):
+ if filename.endswith('.mp3'):
+ path = os.path.join(music_directory, filename)
+ audiofile = eyed3.load(path)
+ title = audiofile.tag.title if audiofile.tag else 'Unknown Title'
+ music_files.append({'id': filename.split('.')[0], 'title': title})
+ print({'music_files':music_files})
+ emit('music_list', {'music_files': music_files})
+
+@socketio.on('download')
+def handle_download(data):
+ url = data['youtube_url']
+ if 'youtube.com' in url:
+ video_id = url.split('=')[1][:11] # Extract the video ID from the YouTube URL
+ elif 'youtu.be' in url:
+ video_id = url.split('youtu.be/')[1][:11]
+ else:
+ #return jsonify({'status': 'error', 'message': 'Invalid YouTube URL'})
+ emit('download_status', {'status': 'error', 'message': 'Invalid YouTube URL'})
+ output_path = os.path.expanduser(f'{home_directory}/Music/{video_id}.mp3') # Path where the file will be saved
+
+ if not os.path.exists(output_path):
+ print("Downloading...")
+ # Configure yt-dlp to download best audio quality
+ ydl_opts = {
+ 'format': 'bestaudio/best',
+ 'postprocessors': [{
+ 'key': 'FFmpegExtractAudio',
+ 'preferredcodec': 'mp3',
+ 'preferredquality': '192',
+ }],
+ 'noplaylist': True,
+ 'quiet': True,
+ 'outtmpl': output_path[:-4] # Use the custom path as the output template
+ }
+
+ # Use yt-dlp to extract information and download the audio file
+ with yt_dlp.YoutubeDL(ydl_opts) as ydl:
+ info = ydl.extract_info(url, download=True)
+ title = info.get('title') # Extract the title from video information
+
+ # Load the downloaded file using eyed3 and add ID3 tags
+ audiofile = eyed3.load(output_path)
+ if audiofile.tag is None: # Create an ID3 tag if none exist
+ audiofile.tag = eyed3.id3.Tag()
+ audiofile.tag.file_info = eyed3.id3.FileInfo(output_path)
+
+ print(f"Downloaded: {title}")
+ audiofile.tag.title = title
+ audiofile.tag.save() # Save the metadata
+ emit('download_status', {'status': 'success', 'message': 'Song added successfully'})
+
+playing_thread = False
+@socketio.on('play')
+def handle_play(data):
+ global music_queue
+ global title_queue
+ global playing_thread
+ global player
+ music_queue.append(data['songId'])
+ title_queue.append(data['songTitle'])
+ if not playing_thread:
+ while len(music_queue) > 0:
+ playing_thread = True
+ player = vlc.MediaPlayer(f'{home_directory}/Music/{music_queue[0]}.mp3')
+ player.play()
+ print(f"Playing: {title_queue[0]}")
+ emit('current', {'title': title_queue[0]})
+ emit('queue', [{'id': idx, 'title': title} for idx, title in enumerate(title_queue)])
+ # Wait for the audio to start playing and check periodically if it is still playing
+ time.sleep(1) # Short initial delay to allow playback to start
+ while player.is_playing():
+ #print('Playing...')
+ time.sleep(0.5) # Check every second if it is still playing
+ #emit('time', {'time': player.get_time()})
+ #print(player.get_time())
+ #print(player.get_length())
+ #print((player.get_time()/player.get_length()))
+ emit('time', {'time': (player.get_time()/player.get_length())})
+ player.stop()
+ music_queue.pop(0)
+ title_queue.pop(0)
+ playing_thread = False
+ emit('play_return', {'status': 'success', 'message': 'Playing song'})
+
+@socketio.on('get_queue')
+def handle_get_queue():
+ emit('queue', [{'id': idx, 'title': title} for idx, title in enumerate(title_queue)])
+
+@socketio.on('remove_from_queue')
+def handle_remove_from_queue(data):
+ global music_queue
+ global title_queue
+ global player
+ #data = request.json
+ song_id = int(data['songId'])
+ try:
+ #del music_queue[song_id]
+ #del title_queue[song_id]
+ if song_id == 0:
+ player.stop()
+ else:
+ music_queue.pop(song_id)
+ title_queue.pop(song_id)
+ #return jsonify({'status': 'success', 'message': 'Song removed successfully'})
+ emit('remove_return', {'status': 'success', 'message': 'Song removed successfully'})
+ except IndexError:
+ #return jsonify({'status': 'error', 'message': 'Invalid song ID'}), 400
+ emit('remove_return', {'status': 'error', 'message': 'Invalid song ID'})
+
+@socketio.on('current_song')
+def handle_current_song():
+ if title_queue:
+ emit('current', {'title': title_queue[0]})
+ else:
+ emit('current', {'title': 'Nothing is playing'})
+
+@app.route('/')
+def index():
+ return render_template('manage2.html')
+
+@app.route('/display')
+def display():
+ return render_template('display2.html')
+
+if __name__ == '__main__':
+ socketio.run(app, host='0.0.0.0', debug=True, port=5000)
diff --git a/manage1.html b/manage1.html
new file mode 100644
index 0000000..78abcdc
--- /dev/null
+++ b/manage1.html
@@ -0,0 +1,328 @@
+
+
+
+
+ Manage Queue
+
+
+
+