Add files via upload

This commit is contained in:
Relationship
2026-07-12 18:48:50 +01:00
committed by GitHub
parent b772223dc2
commit b804d2ce13
3 changed files with 1247 additions and 47 deletions
+1226 -44
View File
File diff suppressed because it is too large Load Diff
+20 -2
View File
@@ -2345,12 +2345,30 @@ foreach ($file in $files) {
$name = Escape-LuaString($file.BaseName) $name = Escape-LuaString($file.BaseName)
$duration = Get-TrackDurationSeconds -File $file $duration = Get-TrackDurationSeconds -File $file
# Derive the subfolder (path under Media\ minus the file leaf). Empty
# string means the track lives directly under Media\. This is what the
# addon uses to build folder auto-playlists in the header dropdown.
$folderRaw = ''
$lastSlash = $relative.LastIndexOf('\')
if ($lastSlash -ge 0) {
$folderRaw = $relative.Substring(0, $lastSlash)
}
$folder = Escape-LuaString($folderRaw)
# dateAdded: seconds since Unix epoch based on file creation time (UTC).
# Falls back to LastWriteTime if CreationTime is zero for some reason.
$ctime = $file.CreationTimeUtc
if ($ctime.Year -lt 1971) { $ctime = $file.LastWriteTimeUtc }
$epoch = [int][Math]::Floor(($ctime - (New-Object DateTime 1970, 1, 1, 0, 0, 0, ([DateTimeKind]::Utc))).TotalSeconds)
$size = [int64]$file.Length
if ($duration -eq $DEFAULT_DURATION) { if ($duration -eq $DEFAULT_DURATION) {
$defaultCount++ $defaultCount++
} }
$fmtLuaEntry = ' {{ path = "{0}", name = "{1}", duration = {2} }},' $fmtLuaEntry = ' {{ path = "{0}", name = "{1}", duration = {2}, folder = "{3}", dateAdded = {4}, size = {5} }},'
$lines.Add(($fmtLuaEntry -f $luaPath, $name, $duration)) | Out-Null $lines.Add(($fmtLuaEntry -f $luaPath, $name, $duration, $folder, $epoch, $size)) | Out-Null
} }
$lines.Add('}') | Out-Null $lines.Add('}') | Out-Null
+1 -1
View File
@@ -2,7 +2,7 @@
## Title: Relationships Jukebox ## Title: Relationships Jukebox
## Notes: Simple in-game MP3/WAV/OGG player with GUI. ## Notes: Simple in-game MP3/WAV/OGG player with GUI.
## Author: Relationship ## Author: Relationship
## Version: 1.4 ## Version: 1.5
## SavedVariables: RelationshipsJukeboxDB ## SavedVariables: RelationshipsJukeboxDB
## X-Website: https://github.com/Relationship-OctoWoW/RelationshipsJukeBox ## X-Website: https://github.com/Relationship-OctoWoW/RelationshipsJukeBox
## X-GitHub: https://github.com/Relationship-OctoWoW/RelationshipsJukeBox ## X-GitHub: https://github.com/Relationship-OctoWoW/RelationshipsJukeBox