mirror of
https://github.com/fiso64/slsk-batchdl.git
synced 2024-12-22 06:22:41 +00:00
expand tildes in input paths
This commit is contained in:
parent
d5a4750da0
commit
13f3cbff47
2 changed files with 11 additions and 11 deletions
|
@ -17,19 +17,19 @@ namespace Extractors
|
|||
|
||||
public async Task<TrackLists> GetTracks(string input, int maxTracks, int offset, bool reverse)
|
||||
{
|
||||
if (!File.Exists(input))
|
||||
throw new FileNotFoundException($"CSV file '{input}' not found");
|
||||
csvFilePath = Utils.ExpandUser(input);
|
||||
|
||||
csvFilePath = input;
|
||||
if (!File.Exists(csvFilePath))
|
||||
throw new FileNotFoundException($"CSV file '{csvFilePath}' not found");
|
||||
|
||||
var tracks = await ParseCsvIntoTrackInfo(input, Config.I.artistCol, Config.I.titleCol, Config.I.lengthCol,
|
||||
var tracks = await ParseCsvIntoTrackInfo(csvFilePath, Config.I.artistCol, Config.I.titleCol, Config.I.lengthCol,
|
||||
Config.I.albumCol, Config.I.descCol, Config.I.ytIdCol, Config.I.trackCountCol, Config.I.timeUnit, Config.I.ytParse);
|
||||
|
||||
if (reverse)
|
||||
tracks.Reverse();
|
||||
|
||||
var trackLists = TrackLists.FromFlattened(tracks.Skip(offset).Take(maxTracks));
|
||||
var csvName = Path.GetFileNameWithoutExtension(input);
|
||||
var csvName = Path.GetFileNameWithoutExtension(csvFilePath);
|
||||
|
||||
foreach (var tle in trackLists.lists)
|
||||
{
|
||||
|
|
|
@ -16,12 +16,12 @@ namespace Extractors
|
|||
|
||||
public async Task<TrackLists> GetTracks(string input, int maxTracks, int offset, bool reverse)
|
||||
{
|
||||
if (!File.Exists(input))
|
||||
throw new FileNotFoundException($"List file '{input}' not found");
|
||||
listFilePath = Utils.ExpandUser(input);
|
||||
|
||||
if (!File.Exists(listFilePath))
|
||||
throw new FileNotFoundException($"List file '{listFilePath}' not found");
|
||||
|
||||
listFilePath = input;
|
||||
|
||||
var lines = File.ReadAllLines(input);
|
||||
var lines = File.ReadAllLines(listFilePath);
|
||||
|
||||
var trackLists = new TrackLists();
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace Extractors
|
|||
int count = 0;
|
||||
int added = 0;
|
||||
|
||||
string foldername = Path.GetFileNameWithoutExtension(input);
|
||||
string foldername = Path.GetFileNameWithoutExtension(listFilePath);
|
||||
|
||||
for (int i = start; i < lines.Length && i >= 0; i += step)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue