diff --git a/.env b/.env new file mode 100644 index 0000000..afc0cf5 --- /dev/null +++ b/.env @@ -0,0 +1,5 @@ +CLIENT_PORT = 8000 +SERVER_PORT = 19054 + +SOUND_LOCATION = C:\Users\dylan\Music +DB_LOCATION = C:\Users\dylan\Document \ No newline at end of file diff --git a/Client/Dockerfile b/Client/Dockerfile new file mode 100644 index 0000000..82c49c9 --- /dev/null +++ b/Client/Dockerfile @@ -0,0 +1,7 @@ +FROM httpd:2.4 +WORKDIR /app + +COPY . /usr/local/apache2/htdocs + +EXPOSE 80 + diff --git a/Compose.yaml b/Compose.yaml new file mode 100644 index 0000000..29a2b7e --- /dev/null +++ b/Compose.yaml @@ -0,0 +1,19 @@ +name: party-jukebox + +services: + pj-client: + build: ./client + ports: + - ${CLIENT_PORT:-80}:80 + pj-db-builder: + # tbd + pj-server: + build: ./server + depends_on: + pj-db-builder: + condition: service_completed_successfully + ports: + - ${SERVER_PORT:-19054}:19054 + volumes: + - ${SOUND_LOCATION}:/sound + - ${DB_LOCATION}:/db \ No newline at end of file diff --git a/Server/Dockerfile b/Server/Dockerfile new file mode 100644 index 0000000..047c96f --- /dev/null +++ b/Server/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.13 +workdir /app2 + +COPY . . + +RUN apt-get update +RUN apt-get upgrade +#RUN apt-get install vlc -y +#RUN pip install -r requirements.txt + +# RUN python3 databaseGenerator.py -m new -d /sound + +#CMD ["python3","webbyBits.py"] +RUN ls \ No newline at end of file diff --git a/Server/databaseGenerator.py b/Server/databaseGenerator.py index e83cbc3..65c18ee 100644 --- a/Server/databaseGenerator.py +++ b/Server/databaseGenerator.py @@ -11,19 +11,21 @@ parser.add_argument('-k','--apikey', help='String: LastFM api key', default="") parser.add_argument('-m', '--mode', help='new/update: Remake database or update current', default= "update") parser.add_argument('-a', '--art', help="True/False: Add art to the database using LastFm (takes minimum 0.25s per song)", default="True") parser.add_argument('-d','--directory',help="Directory of the song files", default="./sound/") +parser.add_argument('-b','--database',help="Location of the .db file",default='.') args = parser.parse_args() apikeylastfm = args.apikey -if args.directory[-1] == "/" or args.directory[-1] == "\\": - soundLocation = args.directory -elif "/" in args.directory: - soundLocation = args.directory + "/" -else: - soundLocation = args.directory + "\\" +soundLocation = args.directory +# if args.directory[-1] == "/" or args.directory[-1] == "\\": +# soundLocation = args.directory +# elif "/" in args.directory: +# soundLocation = args.directory + "/" +# else: +# soundLocation = args.directory + "\\" # if you want to set the api key/sound directory permenantly for your setup just uncomment the next line # apikeylastfm = "KeyHere" # soundLocation = "directoryHere" songFiles = os.listdir(soundLocation) -fileOfDB = sql.connect("songDatabase.db") +fileOfDB = sql.connect(args.database+"/songDatabase.db") songDatabase = fileOfDB.cursor() # setting song directory songDatabase.execute("CREATE TABLE IF NOT EXISTS meta (id TEXT PRIMARY KEY, data TEXT);") diff --git a/requirements.txt b/Server/requirements.txt similarity index 100% rename from requirements.txt rename to Server/requirements.txt diff --git a/Server/webbyBits.py b/Server/webbyBits.py index 614e1b4..99f4a5e 100644 --- a/Server/webbyBits.py +++ b/Server/webbyBits.py @@ -8,9 +8,11 @@ parser=argparse.ArgumentParser(description="Options for the Webby Bits") # this is no longer needed assuming my file works correctly with the generator # parser.add_argument('-d','--directory',help="Directory of the song files (make sure this matches the directory used for the databaseGenerator)", default="./sound/") parser.add_argument('-p','--port',help="Port to host on, not the same as the web (client) port",default='19054') -portTheUserPicked=parser.parse_args().port +parser.add_argument('-b','--database',help="Location of the .db file",default='.') +args = parser.parse_args() +portTheUserPicked=args.port -fileofDB = sql.connect("songDatabase.db") +fileofDB = sql.connect(args.database+"/songDatabase.db") songDatabase = fileofDB.cursor() #song directory