Commit 753b6eaa authored by Jonny Schäfer's avatar Jonny Schäfer
Browse files

change page number parameter from string to integer

parent 7ee4e2fb
...@@ -98,19 +98,16 @@ func logicSearch(title string) { ...@@ -98,19 +98,16 @@ func logicSearch(title string) {
} }
logicVarLazy = listNew(upd) logicVarLazy = listNew(upd)
logicSearchPage("searching: "+title, "0") logicSearchPage("searching: " + title, 0)
} }
//logicSearchPage searches the title in the given page //logicSearchPage searches the title in the given page
func logicSearchPage(title, page string) { func logicSearchPage(title string, page int) {
cliStatus("page " + page + " | " + title) cliStatus("page " + strconv.Itoa(page) + " | " + title)
logicVarWindow = logicWindowSearch logicVarWindow = logicWindowSearch
logicVarSearch = title logicVarSearch = title
pnum, err := strconv.Atoi(page) list := logicVarLazy.listSlice(page * logicVarLineCount, (page + 1) * logicVarLineCount)
errorCare(err)
list := logicVarLazy.listSlice(pnum*logicVarLineCount, (pnum+1)*logicVarLineCount)
if list == nil { if list == nil {
cliStatusError("network error: unable to load data") cliStatusError("network error: unable to load data")
...@@ -155,11 +152,14 @@ func logicNumber(command string) { ...@@ -155,11 +152,14 @@ func logicNumber(command string) {
// logicPage selects the given page // logicPage selects the given page
func logicPage(page string) { func logicPage(page string) {
pnum, err := strconv.Atoi(page)
errorCare(err)
switch logicVarWindow { switch logicVarWindow {
case logicWindowSearch: case logicWindowSearch:
logicSearchPage(logicVarSearch, page) logicSearchPage(logicVarSearch, pnum)
case logicWindowUser: case logicWindowUser:
logicUserPage(logicVarUser, page) logicUserPage(logicVarUser, pnum)
} }
} }
...@@ -249,13 +249,13 @@ func logicSubDel(user string) { ...@@ -249,13 +249,13 @@ func logicSubDel(user string) {
// logicUser shows the videos of the given user // logicUser shows the videos of the given user
func logicUser(user string) { func logicUser(user string) {
logicUserPage(user, "1") logicUserPage(user, 0)
} }
// logicUserPage shows the page of the given user // logicUserPage shows the page of the given user
func logicUserPage(user, page string) { func logicUserPage(user string, page int) {
// TODO: support pages (priority: low) // TODO: support pages (priority: low)
cliStatus("page " + page + " | user: " + user) cliStatus("page " + strconv.Itoa(page) + " | user: " + user)
logicVarWindow = logicWindowUser logicVarWindow = logicWindowUser
logicVarUser = user logicVarUser = user
logicList(-1, videoListUser(user)) logicList(-1, videoListUser(user))
...@@ -302,7 +302,7 @@ func logicNew(none string) { ...@@ -302,7 +302,7 @@ func logicNew(none string) {
return all return all
} }
logicVarLazy = listNew(upd) logicVarLazy = listNew(upd)
logicSearchPage("new videos", "0") logicSearchPage("new videos", 0)
} }
// logicSet sets the key to the given value. Format: "key value" // logicSet sets the key to the given value. Format: "key value"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment