mirror of
https://github.com/fiso64/slsk-batchdl.git
synced 2024-12-22 14:32:40 +00:00
xifgub
This commit is contained in:
parent
9904316bdf
commit
6380df3833
4 changed files with 26 additions and 11 deletions
|
@ -139,6 +139,7 @@ Options:
|
|||
single (default): Show transfer state and percentage
|
||||
double: Transfer state and a large progress bar
|
||||
simple: No download bars or changing percentages
|
||||
--listen-port <port> Port for incoming connections (default: 50000)
|
||||
|
||||
--print <option> Print tracks or search results instead of downloading:
|
||||
tracks: Print all tracks to be downloaded
|
||||
|
|
|
@ -25,7 +25,7 @@ using ProgressBar = Konsole.ProgressBar;
|
|||
|
||||
static class Program
|
||||
{
|
||||
static SoulseekClient client = new SoulseekClient();
|
||||
static SoulseekClient? client = null;
|
||||
static ConcurrentDictionary<Track, SearchInfo> searches = new ConcurrentDictionary<Track, SearchInfo>();
|
||||
static ConcurrentDictionary<string, DownloadWrapper> downloads = new ConcurrentDictionary<string, DownloadWrapper>();
|
||||
static List<Track> tracks = new List<Track>();
|
||||
|
@ -117,6 +117,7 @@ static class Program
|
|||
static int maxConcurrentProcesses = 2;
|
||||
static int maxRetriesPerTrack = 30;
|
||||
static int maxResultsPerUser = 30;
|
||||
static int listenPort = 50000;
|
||||
static bool slowConsoleOutput = false;
|
||||
|
||||
static object consoleLock = new object();
|
||||
|
@ -251,6 +252,7 @@ static class Program
|
|||
"\n single (default): Show transfer state and percentage" +
|
||||
"\n double: Transfer state and a large progress bar " +
|
||||
"\n simple: No download bars or changing percentages" +
|
||||
"\n --listen-port <port> Port for incoming connections (default: 50000)" +
|
||||
"\n" +
|
||||
"\n --print <option> Print tracks or search results instead of downloading:" +
|
||||
"\n tracks: Print all tracks to be downloaded" +
|
||||
|
@ -465,6 +467,9 @@ static class Program
|
|||
case "--m3u-only":
|
||||
m3uOnly = true;
|
||||
break;
|
||||
case "--listen-port":
|
||||
listenPort = int.Parse(args[++i]);
|
||||
break;
|
||||
case "--search-timeout":
|
||||
searchTimeout = int.Parse(args[++i]);
|
||||
break;
|
||||
|
@ -595,10 +600,12 @@ static class Program
|
|||
if (input == "")
|
||||
input = args[i];
|
||||
else
|
||||
throw new ArgumentException();
|
||||
throw new ArgumentException($"Invalid argument \"{input}\"");
|
||||
}
|
||||
}
|
||||
|
||||
client = new SoulseekClient(new SoulseekClientOptions(listenPort: listenPort));
|
||||
|
||||
if (input == "")
|
||||
throw new ArgumentException($"No input provided");
|
||||
|
||||
|
|
|
@ -137,14 +137,21 @@ public class Spotify
|
|||
|
||||
foreach (var track in tracks.Items)
|
||||
{
|
||||
string[] artists = ((IEnumerable<object>)track.Track.ReadProperty("artists")).Select(a => (string)a.ReadProperty("name")).ToArray();
|
||||
string artist = artists[0];
|
||||
string name = (string)track.Track.ReadProperty("name");
|
||||
string album = (string)track.Track.ReadProperty("album").ReadProperty("name");
|
||||
string uri = (string)track.Track.ReadProperty("uri");
|
||||
int duration = (int)track.Track.ReadProperty("durationMs");
|
||||
try
|
||||
{
|
||||
string[] artists = ((IEnumerable<object>)track.Track.ReadProperty("artists")).Select(a => (string)a.ReadProperty("name")).ToArray();
|
||||
string artist = artists[0];
|
||||
string name = (string)track.Track.ReadProperty("name");
|
||||
string album = (string)track.Track.ReadProperty("album").ReadProperty("name");
|
||||
string uri = (string)track.Track.ReadProperty("uri");
|
||||
int duration = (int)track.Track.ReadProperty("durationMs");
|
||||
|
||||
res.Add(new Track { Album = album, ArtistName = artist, TrackTitle = name, Length = duration / 1000, URI = uri });
|
||||
res.Add(new Track { Album = album, ArtistName = artist, TrackTitle = name, Length = duration / 1000, URI = uri });
|
||||
}
|
||||
catch
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (tracks.Items.Count < limit || res.Count >= max)
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
<PackageReference Include="Goblinfactory.ProgressBar" Version="1.0.0" />
|
||||
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.63.0.3205" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.54" />
|
||||
<PackageReference Include="Soulseek" Version="6.1.3" />
|
||||
<PackageReference Include="Soulseek" Version="6.2.0" />
|
||||
<PackageReference Include="SpotifyAPI.Web" Version="7.0.2" />
|
||||
<PackageReference Include="SpotifyAPI.Web.Auth" Version="7.0.2" />
|
||||
<PackageReference Include="TagLibSharp" Version="2.3.0" />
|
||||
<PackageReference Include="YoutubeExplode" Version="6.3.8" />
|
||||
<PackageReference Include="YoutubeExplode" Version="6.3.9" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
Loading…
Reference in a new issue