Skip to content
This repository has been archived by the owner on Jul 13, 2024. It is now read-only.

Commit

Permalink
add Dub selection (series download)
Browse files Browse the repository at this point in the history
simplified season selection by adding a Dub dropdown
added notification for dub override while selecting another dub
added 'en-IN' language
fix ' not found' string to crash ffmpeg due to spaces
  • Loading branch information
hama3254 committed Jan 6, 2024
1 parent e2444a2 commit d2797b4
Show file tree
Hide file tree
Showing 7 changed files with 486 additions and 356 deletions.
Binary file modified .vs/Crunchyroll Downloader/v17/.suo
Binary file not shown.
531 changes: 274 additions & 257 deletions Crunchyroll Downloader/Anime_Add.Designer.vb

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Crunchyroll Downloader/Anime_Add.resx
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,7 @@
<metadata name="BackgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>24, 23</value>
</metadata>
<metadata name="TT_Dub.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>187, 23</value>
</metadata>
</root>
120 changes: 85 additions & 35 deletions Crunchyroll Downloader/Anime_Add.vb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Imports System.Windows.Forms.VisualStyles.VisualStyleElement.Status
Imports Newtonsoft.Json.Linq
Imports System.Timers
Imports System.Security.Policy
Imports Crunchyroll_Downloader.CRD_Classes

Public Class Anime_Add
Public Mass_DL_Cancel As Boolean = False
Expand Down Expand Up @@ -299,9 +300,9 @@ Public Class Anime_Add
bt_Cancel_mass.Enabled = False
bt_Cancel_mass.Visible = False
Main.DownloadFunimationJS_Seasons()
comboBox4.Enabled = False
comboBox3.Enabled = False
ComboBox1.Enabled = False
CB_EP1.Enabled = False
CB_EP0.Enabled = False
CB_Season.Enabled = False

ElseIf CBool(InStr(Main.WebbrowserURL, "crunchyroll.com")) = True Then

Expand All @@ -313,9 +314,9 @@ Public Class Anime_Add
bt_Cancel_mass.Visible = False

Main.DownloadBetaSeasons()
comboBox4.Enabled = False
comboBox3.Enabled = False
ComboBox1.Enabled = False
CB_EP1.Enabled = False
CB_EP0.Enabled = False
CB_Season.Enabled = False


End If
Expand Down Expand Up @@ -461,34 +462,54 @@ Public Class Anime_Add
Dim episode_id As String = Entry.GetValue("id").ToString
Dim slug_title As String = Entry.GetValue("slug_title").ToString

comboBox3.Items.Add("Episode " + episode_number)
comboBox4.Items.Add("Episode " + episode_number)
Main.CR_MassEpisodes.Add(New CR_Seasons(episode_id, slug_title, Main.CR_MassSeasons.Item(ComboBox1.SelectedIndex).Auth))
CB_EP0.Items.Add("Episode " + episode_number)
CB_EP1.Items.Add("Episode " + episode_number)
Main.CR_MassEpisodes.Add(New CR_Seasons(episode_id, slug_title, Main.CR_MassSeasons.Item(CB_Season.SelectedIndex).Auth, ""))

Next
End Select
Next

If comboBox3.Items.Count > 0 Then
comboBox3.SelectedIndex = 0
comboBox4.SelectedIndex = comboBox4.Items.Count - 1
If CB_EP0.Items.Count > 0 Then
CB_EP0.SelectedIndex = 0
CB_EP1.SelectedIndex = CB_EP1.Items.Count - 1
End If

comboBox3.Enabled = True
comboBox4.Enabled = True
CB_EP0.Enabled = True
CB_EP1.Enabled = True

End Sub

Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CB_Season.SelectedIndexChanged
If CBool(InStr(Main.WebbrowserURL, "crunchyroll.com")) = True Then
comboBox3.Items.Clear()
comboBox4.Items.Clear()
comboBox3.Enabled = False
comboBox4.Enabled = False
comboBox3.Text = Nothing
comboBox4.Text = Nothing
CB_EP0.Items.Clear()
CB_EP1.Items.Clear()
CB_EP0.Enabled = False
CB_EP1.Enabled = False
CB_EP0.Text = Nothing
CB_EP1.Text = Nothing


'get guid

Dim guid As String = Nothing

For i As Integer = 0 To Main.CR_MassSeasons.Count - 1
If "Season " + Main.CR_MassSeasons.Item(i).Season = CB_Season.Text And Main.ConvertSubValue(Main.CR_MassSeasons.Item(i).audio_locale, ConvertSubsEnum.DisplayText) = CB_Dub.Text Then
guid = Main.CR_MassSeasons.Item(i).guid
'MsgBox(guid + vbNewLine + Main.CR_MassSeasons.Item(i).audio_locale)
End If
Next

If guid = Nothing Then
MsgBox("Requested guid not found", MsgBoxStyle.Critical)
Exit Sub
End If

' Dim JsonUrl As String = "https://www.crunchyroll.com/content/v2/cms/seasons/" + Main.CR_MassSeasons.Item(CB_Season.SelectedIndex).guid + "/episodes?preferred_audio_language=" + Main.DubSprache.CR_Value + "&locale=" + Main.locale

Dim JsonUrl As String = "https://www.crunchyroll.com/content/v2/cms/seasons/" + guid + "/episodes?preferred_audio_language=" + Main.DubSprache.CR_Value + "&locale=" + Main.locale

Dim JsonUrl As String = "https://www.crunchyroll.com/content/v2/cms/seasons/" + Main.CR_MassSeasons.Item(ComboBox1.SelectedIndex).guid + "/episodes?preferred_audio_language=" + Main.DubSprache.CR_Value + "&locale=" + Main.locale

Dim Loc_CR_Cookies = " -H " + Chr(34) + Main.CR_Cookies.Replace(Chr(34), "").Replace(" -H ", "") + Chr(34)

Expand All @@ -498,7 +519,7 @@ Public Class Anime_Add

Try

EpisodeJson = CurlAuthNew(JsonUrl, Loc_CR_Cookies, Main.CR_MassSeasons.Item(ComboBox1.SelectedIndex).Auth) '
EpisodeJson = CurlAuthNew(JsonUrl, Loc_CR_Cookies, Main.CR_MassSeasons.Item(CB_Season.SelectedIndex).Auth) '

Catch ex As Exception
If CBool(InStr(ex.ToString, "Error - Getting")) Then
Expand All @@ -516,14 +537,14 @@ Public Class Anime_Add


ElseIf Main.WebbrowserURL = "https://funimation.com/js" Then
comboBox3.Items.Clear()
comboBox4.Items.Clear()
comboBox3.Text = Nothing
comboBox4.Text = Nothing
CB_EP0.Items.Clear()
CB_EP1.Items.Clear()
CB_EP0.Text = Nothing
CB_EP1.Text = Nothing
Dim ContentID As String = Nothing

For i As Integer = 0 To Main.FunimtaionSeasonList.Count - 1
If ComboBox1.Text = Main.FunimtaionSeasonList.Item(i).Title Then
If CB_Season.Text = Main.FunimtaionSeasonList.Item(i).Title Then
ContentID = Main.FunimtaionSeasonList.Item(i).ID
Exit For
End If
Expand Down Expand Up @@ -559,9 +580,9 @@ Public Class Anime_Add
FillFunimationEpisodes(EpisodeJson)


If comboBox3.Items.Count > 0 Then
comboBox3.SelectedIndex = 0
comboBox4.SelectedIndex = comboBox4.Items.Count - 1
If CB_EP0.Items.Count > 0 Then
CB_EP0.SelectedIndex = 0
CB_EP1.SelectedIndex = CB_EP1.Items.Count - 1
End If


Expand All @@ -573,16 +594,16 @@ Public Class Anime_Add
Public Sub FillFunimationEpisodes(ByVal EpisodeJson As String)

Main.FunimationEpisodeJSON = EpisodeJson
comboBox3.Enabled = True
comboBox4.Enabled = True
CB_EP0.Enabled = True
CB_EP1.Enabled = True

Dim EpisodeSplit() As String = EpisodeJson.Split(New String() {Chr(34) + "episodeNumber" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
'EpisodeJson.Split(New String() {Chr(34) + "episodeNumber" + Chr(34) + ": " + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Debug.WriteLine(EpisodeSplit.Count.ToString)
For i As Integer = 1 To EpisodeSplit.Count - 1
Dim EpisodeSplit2() As String = EpisodeSplit(i).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
comboBox3.Items.Add("Episode " + EpisodeSplit2(0))
comboBox4.Items.Add("Episode " + EpisodeSplit2(0))
CB_EP0.Items.Add("Episode " + EpisodeSplit2(0))
CB_EP1.Items.Add("Episode " + EpisodeSplit2(0))
Next
Main.WebbrowserURL = "https://funimation.com/js"
End Sub
Expand Down Expand Up @@ -690,6 +711,35 @@ Public Class Anime_Add
End If
End Sub

Private Sub CB_Dub_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CB_Dub.SelectedIndexChanged
'MsgBox(CB_Dub.Text)
'MsgBox(Main.DubSprache.DisplayText)

If My.Settings.OverrideDub = True And CBool(InStr(CB_Dub.Text, Main.DubSprache.DisplayText)) = False Then
MessageBox.Show("The Duboveride might change the Dub to: " + Main.DubSprache.DisplayText, "Settings - Override enabled", MessageBoxButtons.OK)
End If

'clear everything below the dub
CB_Season.Items.Clear()
CB_EP0.Items.Clear()
CB_EP1.Items.Clear()

'also remove display text
CB_Season.Text = Nothing
CB_EP0.Text = Nothing
CB_EP1.Text = Nothing

For i As Integer = 0 To Main.CR_MassSeasons.Count - 1
If Main.ConvertSubValue(Main.CR_MassSeasons.Item(i).audio_locale, ConvertSubsEnum.DisplayText) = CB_Dub.Text Then
CB_Season.Items.Add("Season " + Main.CR_MassSeasons.Item(i).Season)
End If
Next



CB_Season.Enabled = True
End Sub


End Class

6 changes: 4 additions & 2 deletions Crunchyroll Downloader/CRD-Classes.vb
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,20 @@ End Class

Public Class CR_Seasons

Public Season As String
Public guid As String
Public audio_locale As String
Public Auth As String
Public Sub New(ByVal guid As String, ByVal audio_locale As String, ByVal Auth As String)
Public Sub New(ByVal guid As String, ByVal audio_locale As String, ByVal Auth As String, ByVal Season As String)
Me.Season = Season
Me.guid = guid
Me.audio_locale = audio_locale
Me.Auth = Auth

End Sub

Public Overrides Function ToString() As String
Return String.Format("{0}, {1}", Me.guid, Me.audio_locale)
Return String.Format("{0}, {1}", Me.guid, Me.audio_locale, Me.Season)
End Function
End Class

Expand Down
Loading

0 comments on commit d2797b4

Please sign in to comment.