Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Jellyfin.Plugin.FinTube/Api/FinTubeActivityController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class FinTubeData
public string ytid {get; set;} = "";
public string targetlibrary{get; set;} = "";
public string targetfolder{get; set;} = "";
public string ytdlpargs{get; set;} = "";
public string targetfilename { get; set; } = "";
public bool audioonly{get; set;} = false;
public bool preferfreeformat{get; set;} = false;
Expand All @@ -68,7 +69,7 @@ public ActionResult<Dictionary<string, object>> FinTubeDownload([FromBody] FinTu
{
try
{
_logger.LogInformation("FinTubeDownload : {ytid} to {targetfoldeer}, prefer free format: {preferfreeformat} audio only: {audioonly}", data.ytid, data.targetfolder, data.preferfreeformat, data.audioonly);
_logger.LogInformation("FinTubeDownload : {ytid} to {targetfoldeer}, prefer free format: {preferfreeformat} audio only: {audioonly}, custom yt-dlp args: {ytdlpargs}", data.ytid, data.targetfolder, data.preferfreeformat, data.audioonly, data.ytdlpargs);

Dictionary<string, object> response = new Dictionary<string, object>();
PluginConfiguration? config = Plugin.Instance.Configuration;
Expand All @@ -78,9 +79,9 @@ public ActionResult<Dictionary<string, object>> FinTubeDownload([FromBody] FinTu
// check binaries
if(!System.IO.File.Exists(config.exec_YTDL))
throw new Exception("YT-DL Executable configured incorrectly");

bool hasid3v2 = System.IO.File.Exists(config.exec_ID3);


// Ensure proper / separator
data.targetfolder = String.Join("/", data.targetfolder.Split("/", StringSplitOptions.RemoveEmptyEntries));
Expand Down Expand Up @@ -131,6 +132,8 @@ public ActionResult<Dictionary<string, object>> FinTubeDownload([FromBody] FinTu
args += $" -o \"{targetFilename}-%(title)s.%(ext)s\" {data.ytid}";
}

args += $" {data.ytdlpargs}";

status += $"Exec: {config.exec_YTDL} {args}<br>";

var procyt = createProcess(config.exec_YTDL, args);
Expand All @@ -142,7 +145,7 @@ public ActionResult<Dictionary<string, object>> FinTubeDownload([FromBody] FinTu
{
args = $"-a \"{data.artist}\" -A \"{data.album}\" -t \"{data.title}\" -T \"{data.track}\" \"{targetFilename}{targetExtension}\"";

status += $"Exec: {config.exec_ID3} {args}<br>";
status += $"Exec: {config.exec_ID3} {args}<br>";

var procid3 = createProcess(config.exec_ID3, args);
procid3.Start();
Expand Down
16 changes: 11 additions & 5 deletions Jellyfin.Plugin.FinTube/Pages/downloadPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ <h2>FinTube Download</h2>
<div class="fieldDescription">This is the filename if you want to override the yt-dl(p) default (optional)</div>
</div>

<div class="inputContainer">
<label class="inputLabel" for="fintube-ytdlpargs">Command Line Arguments</label>
<input id="fintube-ytdlpargs" class="emby-input" name="fintube-ytdlpargs" />
<div class="fieldDescription">(Advanced) To pass custom command line arguments to yt-dlp</div>
</div>

<div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label">
<input id="fintube-preferfreeformat" name="preferfreeformat" type="checkbox" is="emby-checkbox" data-embycheckbox="true" class="emby-checkbox">
Expand Down Expand Up @@ -67,9 +73,9 @@ <h2>FinTube Download</h2>
</div>
</div>

<div id="fintube-audiosettings" hidden>
<div id="fintube-audiosettings" hidden>
<h3>Audio Settings (Require id3v2 to be configured properly)</h3>

<div class="inputContainer">
<label class="inputLabel">Artist</label>
<input id="fintube-artist" class="emby-input" name="fintube-artist" />
Expand Down Expand Up @@ -140,7 +146,7 @@ <h3>Audio Settings (Require id3v2 to be configured properly)</h3>

document.getElementById('preview').onload = function(e) {
let submitbtn = document.getElementById('fintube-submit');

if(this.width == 120)
submitbtn.setAttribute('disabled', true);
else
Expand Down Expand Up @@ -178,7 +184,7 @@ <h3>Audio Settings (Require id3v2 to be configured properly)</h3>
"title": getfintubeValue("title"),
"track": Number(getfintubeValue("track"))
}


let url = "fintube/submit_dl";
url = window.ApiClient.getUrl(url);
Expand Down Expand Up @@ -213,5 +219,5 @@ <h3>Audio Settings (Require id3v2 to be configured properly)</h3>
</script>
</div>
</div>
</div>
</div>
</div>