File tree 13 files changed +445
-8
lines changed
13 files changed +445
-8
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ PlexAPI = "^4.15.7"
12
12
requests = " ^2.31.0"
13
13
rtoml = " ^0.10.0"
14
14
schedule = " ^1.2.1"
15
+ flask = " ^3.0.2"
15
16
16
17
17
18
[build-system ]
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Ensure the script is executed from the correct directory
4
+ # This script should be run from the root of your project structure
5
+
6
+ # Creating necessary directories if they don't already exist
7
+ mkdir -p static/css
8
+ mkdir -p static/js
9
+ mkdir -p static/img
10
+ mkdir -p templates
11
+
12
+ # Creating placeholder files for Flask
13
+ # Base HTML template
14
+ cat > templates/base.html.j2 << EOF
15
+ <!DOCTYPE html>
16
+ <html lang="en">
17
+ <head>
18
+ <meta charset="UTF-8">
19
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
20
+ <title>Spotiplex</title>
21
+ <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
22
+ </head>
23
+ <body>
24
+ {% block content %}
25
+ {% endblock %}
26
+ </body>
27
+ </html>
28
+ EOF
29
+
30
+ # Home page HTML template
31
+ cat > templates/index.html.j2 << EOF
32
+ {% extends "base.html.j2" %}
33
+
34
+ {% block content %}
35
+ <h1>Welcome to Spotiplex</h1>
36
+ {% endblock %}
37
+ EOF
38
+
39
+ # Placeholder CSS
40
+ cat > static/css/style.css << EOF
41
+ body {
42
+ font-family: Arial, sans-serif;
43
+ }
44
+ EOF
45
+
46
+ # Placeholder main.py (if not already present in spotiplex)
47
+ if [ ! -f spotiplex/main.py ]; then
48
+ cat > spotiplex/main.py << EOF
49
+ from flask import Flask, render_template
50
+
51
+ app = Flask(__name__)
52
+
53
+ @app.route('/')
54
+ def home():
55
+ return render_template('index.html.j2')
56
+
57
+ if __name__ == "__main__":
58
+ app.run(debug=True)
59
+ EOF
60
+ fi
61
+
62
+ echo " Flask app structure is set up. You can now run the app using 'flask run' or 'python -m flask run'."
Original file line number Diff line number Diff line change
1
+ from flask import Flask , render_template
2
+ from .web_ui import functions
3
+
4
+ app = Flask (__name__ )
5
+
6
+
7
+ @app .route ("/" )
8
+ def home ():
9
+ web_functions = functions ()
10
+ data = web_functions .get_dashboard_data ()
11
+ return render_template ("index.html.j2" , data = data )
12
+
13
+
14
+ @app .route ("/settings" )
15
+ def settings ():
16
+ return render_template ("settings.html.j2" )
17
+
18
+
19
+ @app .route ("/playlists" )
20
+ def playlists ():
21
+ return render_template ("playlists.html.j2" )
22
+
23
+
24
+ # @app.route('')
25
+
26
+ if __name__ == "__main__" :
27
+ app .run (debug = True )
Original file line number Diff line number Diff line change 1
1
import json
2
- from confighandler import read_config
2
+ from . confighandler import read_config
3
3
import requests
4
4
# test
5
5
Original file line number Diff line number Diff line change 1
- from plex import PlexService
2
- from spotify import SpotifyService
3
- from lidarr import LidarrAPI as lapi
4
- from confighandler import read_config , write_config
1
+ from . plex import PlexService
2
+ from . spotify import SpotifyService
3
+ from . lidarr import LidarrAPI as lapi
4
+ from . confighandler import read_config , write_config
5
5
import concurrent .futures
6
6
from concurrent .futures import ThreadPoolExecutor
7
7
import schedule
@@ -64,6 +64,7 @@ def __init__(self):
64
64
self .worker_count = int (self .config .get ("worker_count" ))
65
65
self .replace_existing = self .config .get ("replace_existing" )
66
66
self .seconds_interval = int (self .config .get ("seconds_interval" ))
67
+
67
68
if self .lidarr_sync == "true" :
68
69
self .sync_lists = self .lidarr_api .get_lidarr_playlists ()
69
70
else :
Original file line number Diff line number Diff line change 1
1
import requests
2
2
import urllib3
3
3
from plexapi .server import PlexServer
4
- from confighandler import read_config
4
+ from . confighandler import read_config
5
5
6
6
7
7
class PlexService :
Original file line number Diff line number Diff line change 1
1
import spotipy
2
2
from spotipy .oauth2 import SpotifyClientCredentials
3
3
from datetime import date
4
- from confighandler import read_config
4
+ from . confighandler import read_config
5
5
6
6
7
7
class SpotifyService :
You can’t perform that action at this time.
0 commit comments