Skip to content

Commit 87edee5

Browse files
committed
cleanup: core: clean unused imports and remove redundant deps
- rm unused imports from various modules (audio/player, json/statuscache, ui/animation, ui/menu, ui/playerui, ui/ui). - rm redundant dependencies: times from audio/player, asyncdispatch from ui/playerui - rm scroll as an dependency and link since it is not used by menu.nim - rm statuscache's variable fileInConsideration - rm normalizeURL from jsonutils.nim
1 parent 0a3db33 commit 87edee5

File tree

8 files changed

+12
-27
lines changed

8 files changed

+12
-27
lines changed

src/audio/player.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# player.nim
22

3-
import libmpv, terminal, os
3+
import libmpv, os
44
export cE # Export the error-checking macro for external use
55

66
type
@@ -164,7 +164,7 @@ proc getCurrentMediaTitle*(ctx: ptr Handle): string {.raises: [].} =
164164
if title != nil:
165165
libmpv.free(title)
166166

167-
except Exception as e:
167+
except Exception: #as e:
168168
#raise newException(PlayerError, "Failed to get media title: " & e.msg)
169169
discard
170170

src/json/statuscache.nim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# statuscache.nim
22

33
import
4-
json, os, asyncdispatch, ../utils/utils, strutils, times, sequtils, terminal,
4+
json, os, asyncdispatch,
5+
../utils/utils, strutils,
6+
times, terminal,
57

68
../ui/stationstatus
79

@@ -102,7 +104,6 @@ proc saveStatusCacheToJson(stations; statuscontext) =
102104
fileInConsideration.close()
103105

104106
proc readFromExistingStatusCache*(stations; statuscontext): JsonNode =
105-
var fileInConsideration: File
106107
var filePathNameExt = statuscontext.sectionName
107108
getCacheJsonFileNameWithPath(filePathNameExt)
108109

src/ui/animation.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# animation.nim
22

3-
import times, terminal, ../utils/utils
3+
import terminal, ../utils/utils
44

55

66

src/ui/menu.nim

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@
22

33
import
44
terminal, os, strutils, net,
5-
json, tables, random,
5+
random,
66

77
ui, illwill,
88

9-
../audio/[
10-
player,
11-
libmpv,
12-
],
13-
14-
../link/link,
159
../utils/[
1610
utils,
1711
jsonutils
@@ -20,13 +14,9 @@ import
2014
playerui
2115

2216
when not defined(simple):
23-
import asyncdispatch,
24-
25-
../audio/metadata,
17+
import
2618
../ui/[
2719
stationstatus,
28-
scroll,
29-
animation,
3020
],
3121
../json/[
3222
statuscache

src/ui/playerui.nim

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import
2-
terminal, os, strutils, net,
2+
terminal, strutils, net,
33
tables,
44

55
ui, illwill,
@@ -15,8 +15,7 @@ import
1515
]
1616

1717
when not defined(simple):
18-
import asyncdispatch,
19-
18+
import
2019
../audio/metadata,
2120
../ui/[
2221
scroll,

src/ui/ui.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import
1111
]
1212

1313
when not defined(simple):
14-
import theme, stationstatus, scroll, animation
14+
import stationstatus
1515

1616
using str: string
1717

src/utils/jsonutils.nim

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import
33

44
utilstypes
55

6-
from ../link/linkbase import normalizeUrl
7-
86
when defined(useJsmn):
97
import ../json/jsmn
108
else:

src/utils/privjsonstdlib.nim

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import json
22
from ../link/linkbase import normalizeUrl
3-
import
4-
os, strutils,
5-
6-
utilstypes
3+
import utilstypes
74

85
proc loadStationStdLib*(filePath: string): tuple[names, urls: seq[string]] =
96
let jsonData = parseJson(readFile(filePath))

0 commit comments

Comments
 (0)