Skip to content

Commit

Permalink
Add publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
Mbucari committed Apr 9, 2023
1 parent a02b6d0 commit 44e65aa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
6 changes: 3 additions & 3 deletions OverdriveDownloader/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static async Task Main(string[] args)

if (mp4Writer is null)
{
var fileOut = File.Open(Path.ChangeExtension(odmFile, "m4b"), FileMode.OpenOrCreate, FileAccess.ReadWrite);
var fileOut = File.OpenWrite(Path.ChangeExtension(odmFile, "m4b"));

mp4Writer = Mp3ToMp4Writer.Create(partFilename, fileOut);

Expand Down Expand Up @@ -130,7 +130,7 @@ static async Task Main(string[] args)
if (mp4Writer?.Moov.ILst.Children.Any(t => t.Header.Type == "covr") is false
&& odm.Metadata?.CoverUrl is not null)
{
LogInfo("Downloading cover art from {}");
LogInfo($"Downloading cover art from {odm.Metadata.CoverUrl}");
var cover = await new HttpClient().GetByteArrayAsync(odm.Metadata.CoverUrl);
mp4Writer?.Moov.ILst.AddTag("covr", cover, Mpeg4Lib.Boxes.AppleDataType.JPEG);
}
Expand All @@ -141,7 +141,7 @@ static async Task Main(string[] args)
if (mp4Writer?.OutputFile is FileStream fs)
{
LogInfo($"Moving moov atom to beginning of file");
await Mpeg4Util.RelocateMoovToBeginningAsync(fs.Name, default, (a, b, c) => { });
await Mpeg4Util.RelocateMoovToBeginningAsync(fs.Name, default, (_, _, _) => { });
LogInfo($"Complete m4b saved at {fs.Name}");
}

Expand Down
22 changes: 22 additions & 0 deletions publish.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$runtimeIDs = "win-x64","win-x86"

foreach ($runtime in $runtimeIDs)
{
$pubdir="./publish/$runtime"

dotnet publish OverdriveDownloader/OverdriveDownloader.csproj `
-r $runtime `
--self-contained `
-p:PublishSingleFile=true `
-p:PublishReadyToRun=true `
-p:PublishTrimmed=true `
-c Release `
-o $pubdir

rm "$pubdir/*.so"
rm "$pubdir/*.dll"
rm "$pubdir/*.dylib"

Compress-Archive $pubdir "./publish/OverdriveDownloader-$runtime.zip"
rm -r $pubdir
}

0 comments on commit 44e65aa

Please sign in to comment.