Skip to content

Commit d24afde

Browse files
committed
addresses #193, #182
1 parent 94124d3 commit d24afde

File tree

13 files changed

+91
-9
lines changed

13 files changed

+91
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
## v2.6.1
66

7+
- ⚡️ Anime library: Filtering by year now takes into account the season year
8+
- ⚡️ Torrent streaming: Custom stream URL address setting #182
79
- 🦺 Scanner: Fixed duplicated files due to incorrect path comparison
10+
- 🦺 Use AniList season year instead of start year for media cards #193
811
- 🏗️ Issue recorder: Increase data cap limit
912

1013
## v2.6.0

codegen/generated/public_structs.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@
123123
"public": true,
124124
"comments": []
125125
},
126+
{
127+
"name": "SeasonYear",
128+
"jsonName": "seasonYear",
129+
"goType": "int",
130+
"typescriptType": "number",
131+
"required": false,
132+
"public": true,
133+
"comments": []
134+
},
126135
{
127136
"name": "BannerImage",
128137
"jsonName": "bannerImage",
@@ -321,6 +330,15 @@
321330
"public": true,
322331
"comments": []
323332
},
333+
{
334+
"name": "SeasonYear",
335+
"jsonName": "seasonYear",
336+
"goType": "int",
337+
"typescriptType": "number",
338+
"required": false,
339+
"public": true,
340+
"comments": []
341+
},
324342
{
325343
"name": "Type",
326344
"jsonName": "type",
@@ -28005,6 +28023,15 @@
2800528023
"required": true,
2800628024
"public": true,
2800728025
"comments": []
28026+
},
28027+
{
28028+
"name": "StreamUrlAddress",
28029+
"jsonName": "streamUrlAddress",
28030+
"goType": "string",
28031+
"typescriptType": "string",
28032+
"required": true,
28033+
"public": true,
28034+
"comments": []
2800828035
}
2800928036
],
2801028037
"comments": [],

internal/api/anilist/client_gen.go

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/api/anilist/media_helper.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ func (m *CompleteAnime) ToBaseAnime() *BaseAnime {
489489
Synonyms: m.GetSynonyms(),
490490
BannerImage: m.GetBannerImage(),
491491
Season: m.GetSeason(),
492+
SeasonYear: m.GetSeasonYear(),
492493
Type: m.GetType(),
493494
IsAdult: m.GetIsAdult(),
494495
CountryOfOrigin: m.GetCountryOfOrigin(),

internal/api/anilist/queries/anime.graphql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ fragment baseAnime on Media {
275275
season
276276
type
277277
format
278+
seasonYear
278279
bannerImage
279280
episodes
280281
synonyms
@@ -324,6 +325,7 @@ fragment completeAnime on Media {
324325
siteUrl
325326
status(version: 2)
326327
season
328+
seasonYear
327329
type
328330
format
329331
bannerImage

internal/core/modules.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ func (a *App) InitOrRefreshTorrentstreamSettings() {
453453
StreamingServerHost: "0.0.0.0",
454454
StreamingServerPort: 43214,
455455
IncludeInLibrary: false,
456+
StreamUrlAddress: "",
456457
})
457458
if err != nil {
458459
a.Logger.Error().Err(err).Msg("app: Failed to initialize mediastream module")

internal/database/models/models.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,8 @@ type TorrentstreamSettings struct {
330330
StreamingServerPort int `gorm:"column:streaming_server_port" json:"streamingServerPort"` // UNUSED, LEGACY
331331
//FallbackToTorrentStreamingView bool `gorm:"column:fallback_to_torrent_streaming_view" json:"fallbackToTorrentStreamingView"` // DEPRECATED
332332
IncludeInLibrary bool `gorm:"column:include_in_library" json:"includeInLibrary"`
333+
// v2.6+
334+
StreamUrlAddress string `gorm:"column:stream_url_address" json:"streamUrlAddress"`
333335
}
334336

335337
type TorrentstreamHistory struct {

internal/torrentstream/client.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,14 @@ func (c *Client) GetStreamingUrl() string {
240240
return ""
241241
}
242242
address := fmt.Sprintf("%s:%d", c.repository.settings.MustGet().Host, c.repository.settings.MustGet().Port)
243-
return fmt.Sprintf("http://%s/api/v1/torrentstream/stream/%s", address, url.PathEscape(c.currentFile.MustGet().DisplayPath()))
243+
if c.repository.settings.MustGet().StreamUrlAddress != "" {
244+
address = c.repository.settings.MustGet().StreamUrlAddress
245+
}
246+
_url := fmt.Sprintf("http://%s/api/v1/torrentstream/stream/%s", address, url.PathEscape(c.currentFile.MustGet().DisplayPath()))
247+
if strings.HasPrefix(_url, "http://http") {
248+
_url = strings.Replace(_url, "http://http", "http", 1)
249+
}
250+
return _url
244251
}
245252

246253
func (c *Client) AddTorrent(id string) (*torrent.Torrent, error) {

seanime-web/src/api/generated/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ export type AL_BaseAnime = {
398398
season?: AL_MediaSeason
399399
type?: AL_MediaType
400400
format?: AL_MediaFormat
401+
seasonYear?: number
401402
bannerImage?: string
402403
episodes?: number
403404
synonyms?: Array<string>
@@ -2872,6 +2873,7 @@ export type Models_TorrentstreamSettings = {
28722873
*/
28732874
streamingServerPort: number
28742875
includeInLibrary: boolean
2876+
streamUrlAddress: string
28752877
id: number
28762878
createdAt?: string
28772879
updatedAt?: string

seanime-web/src/app/(main)/_features/global-search/global-search.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,8 @@ export function GlobalSearch() {
213213
<p className="text-sm leading-6 text-[--muted]">
214214
{activeOption.format}{activeOption.season
215215
? ` - ${capitalize(activeOption.season)} `
216-
: " - "}{activeOption.startDate?.year
217-
? new Intl.DateTimeFormat("en-US", { year: "numeric" })
218-
.format(new Date(activeOption.startDate?.year || 0,
219-
activeOption.startDate?.month || 0))
216+
: " - "}{activeOption.seasonYear
217+
? activeOption.seasonYear
220218
: "-"}
221219
</p>
222220
</div>

0 commit comments

Comments
 (0)