Skip to content

Commit

Permalink
Merge branch 'next' (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
dxstiny committed Jun 23, 2024
2 parents 1226b67 + e2fd1e4 commit 271ce7d
Show file tree
Hide file tree
Showing 275 changed files with 5,764 additions and 5,352 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-alpine
FROM python:3.12-alpine

RUN apk add --no-cache ffmpeg nginx git && \
mkdir /opt/reAudioPlayer && \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11
FROM python:3.12

RUN apt-get update && apt-get upgrade -y && \
apt-get install -y ffmpeg nginx
Expand Down
14 changes: 7 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: "3.9"
services:
reap-one:
image: "ghcr.io/reaudioplayer/reap-one:1.0.0"
ports:
- "1234:80"
volumes:
- ./src/usr/:/opt/reAudioPlayer/usr/
- ./src/cache/:/opt/reAudioPlayer/server/_cache/
reap-one:
image: "ghcr.io/reaudioplayer/reap-one:1.1.0"
ports:
- "1234:80"
volumes:
- ./src/usr/:/opt/reAudioPlayer/usr/
- ./src/cache/:/opt/reAudioPlayer/server/_cache/
2 changes: 1 addition & 1 deletion one.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off

set VERSION=1.0.0
set VERSION=1.1.0

set command=%1
set arg=%2
Expand Down
4 changes: 2 additions & 2 deletions rebuild.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
docker compose down
docker rmi ghcr.io/reaudioplayer/reap-one:1.0.0
docker rmi ghcr.io/reaudioplayer/reap-one:1.1.0
sudo bash -c 'echo "nameserver 1.1.1.1" > /etc/resolv.conf'
docker build -t ghcr.io/reaudioplayer/reap-one:1.0.0 .
docker build -t ghcr.io/reaudioplayer/reap-one:1.1.0 .
docker compose up -d
6 changes: 3 additions & 3 deletions src/server/config/cacheStrategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def onStrategyLoad(self) -> None:
async def _task() -> None:
for playlist in self._player.playlistManager.playlists:
for song in playlist:
await self._downloader.downloadSong(song.model)
await self._downloader.downloadSong(song, internal=True)

asyncio.create_task(_task())

Expand All @@ -88,7 +88,7 @@ async def _downloadTask(self) -> None:
assert self._playlist is not None
SongCache.prune(self._playlist)
for song in self._playlist:
await self._downloader.downloadSong(song.model)
await self._downloader.downloadSong(song, internal = True)

async def onStrategyLoad(self) -> None:
await super().onStrategyLoad()
Expand All @@ -115,4 +115,4 @@ async def onSongLoad(self, song: Song) -> None:
assert self._playlist is not None
currentSong, nextSong = song, self._playlist.next(True)
SongCache.prune([currentSong, nextSong])
await self._downloader.downloadSong(nextSong.model)
await self._downloader.downloadSong(nextSong, internal = True)
4 changes: 1 addition & 3 deletions src/server/dataModel/song.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,8 @@ def toDict(self) -> Dict[str, Any]:
result["metadata"] = self.metadata.toDict()
return result

def downloadPath(self, forExport: bool = False) -> str:
def downloadPath(self) -> str:
"""return download path"""
if forExport:
return f"{self.model.id}.dl"
return str(self.model.id)

@classmethod
Expand Down
18 changes: 13 additions & 5 deletions src/server/db/table/songs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""reAudioPlayer ONE"""

from __future__ import annotations

__copyright__ = "Copyright (c) 2023 https://github.com/reAudioPlayer"
Expand Down Expand Up @@ -281,20 +282,23 @@ def albumHash(self, value: str) -> None:
self._albumHash = value
self._fireChanged()

@property
def hash(self) -> str:
"""return hash"""
return str(hashids.encode(self.id))

@property
def url(self) -> str:
"""return url"""
return f"/track/{hashids.encode(self.id)}"
return f"/track/{self.hash}"

@property
def albumUrl(self) -> str:
"""return album url"""
return f"/album/{self._albumHash}"

def downloadPath(self, forExport: bool = False) -> str:
def downloadPath(self) -> str:
"""return download path"""
if forExport:
return f"{self.id}.dl"
return str(self.id)

def toDict(self) -> Dict[str, Any]:
Expand All @@ -303,7 +307,11 @@ def toDict(self) -> Dict[str, Any]:
"id": self.id,
"title": self.name,
"artist": self.artist,
"album": {"name": self._album, "id": self._albumHash, "href": self.albumUrl},
"album": {
"name": self._album,
"id": self._albumHash,
"href": self.albumUrl,
},
"cover": self.cover,
"favourite": self.favourite,
"duration": self.duration,
Expand Down
Loading

0 comments on commit 271ce7d

Please sign in to comment.