Add extension to downloaded filename
This commit is contained in:
@@ -74,3 +74,4 @@ Build and push this container to ghcr
|
|||||||
- [x] sort videos most to least recent
|
- [x] sort videos most to least recent
|
||||||
- [x] header on playlist page
|
- [x] header on playlist page
|
||||||
- [x] Choose database directory
|
- [x] Choose database directory
|
||||||
|
- [x] add extension to download
|
||||||
|
@@ -788,8 +788,8 @@ func makeNiceFilename(input string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove any remaining non-alphanumeric characters (except underscores)
|
// Remove any remaining non-alphanumeric characters (except underscores)
|
||||||
reg := regexp.MustCompile("[^a-z0-9_\\.]+")
|
reg := regexp.MustCompile("[^a-z0-9_.-]")
|
||||||
input = reg.ReplaceAllString(input, "")
|
input = reg.ReplaceAllString(input, "x")
|
||||||
|
|
||||||
// Trim leading/trailing underscores
|
// Trim leading/trailing underscores
|
||||||
input = strings.Trim(input, "_")
|
input = strings.Trim(input, "_")
|
||||||
@@ -849,7 +849,7 @@ func videoHandler(c echo.Context) error {
|
|||||||
FPS: fmt.Sprintf("%.1f", video.FPS),
|
FPS: fmt.Sprintf("%.1f", video.FPS),
|
||||||
Size: humanSize(video.Size),
|
Size: humanSize(video.Size),
|
||||||
Filename: video.Filename,
|
Filename: video.Filename,
|
||||||
DownloadFilename: makeNiceFilename(orig.Title),
|
DownloadFilename: makeNiceFilename(orig.Title + filepath.Ext(tempURL.FilePath)),
|
||||||
StreamRate: fmt.Sprintf("%.1f KiB/s", rate/1024),
|
StreamRate: fmt.Sprintf("%.1f KiB/s", rate/1024),
|
||||||
TempURL: tempURL,
|
TempURL: tempURL,
|
||||||
})
|
})
|
||||||
@@ -869,7 +869,7 @@ func videoHandler(c echo.Context) error {
|
|||||||
Kbps: fmt.Sprintf("%.1f kbps", kbps),
|
Kbps: fmt.Sprintf("%.1f kbps", kbps),
|
||||||
Size: humanSize(audio.Size),
|
Size: humanSize(audio.Size),
|
||||||
Filename: audio.Filename,
|
Filename: audio.Filename,
|
||||||
DownloadFilename: makeNiceFilename(orig.Title),
|
DownloadFilename: makeNiceFilename(orig.Title + filepath.Ext(tempURL.FilePath)),
|
||||||
StreamRate: fmt.Sprintf("%.1f KiB/s", rate/1024),
|
StreamRate: fmt.Sprintf("%.1f KiB/s", rate/1024),
|
||||||
TempURL: tempURL,
|
TempURL: tempURL,
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user