Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
wizard: initial (demo) work
- Loading branch information
Showing
16 changed files
with
542 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| /* | ||
| * API - Wizard interface | ||
| * | ||
| * Copyright (C) 2015 Jaroslav Kysela | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; withm even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #include "tvheadend.h" | ||
| #include "channels.h" | ||
| #include "access.h" | ||
| #include "api.h" | ||
| #include "config.h" | ||
| #include "wizard.h" | ||
|
|
||
| static int | ||
| wizard_idnode_load_simple | ||
| ( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp ) | ||
| { | ||
| int r; | ||
| wizard_build_fcn_t fcn = opaque; | ||
| wizard_page_t *page = fcn(); | ||
| r = api_idnode_load_simple(perm, &page->idnode, op, args, resp); | ||
| page->free(page); | ||
| return r; | ||
| } | ||
|
|
||
| static int | ||
| wizard_idnode_save_simple | ||
| ( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp ) | ||
| { | ||
| int r; | ||
| wizard_build_fcn_t fcn = opaque; | ||
| wizard_page_t *page = fcn(); | ||
| r = api_idnode_save_simple(perm, &page->idnode, op, args, resp); | ||
| page->free(page); | ||
| return r; | ||
| } | ||
|
|
||
| static int | ||
| wizard_cancel | ||
| ( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp ) | ||
| { | ||
| pthread_mutex_lock(&global_lock); | ||
| free(config.wizard); | ||
| config.wizard = strdup(""); | ||
| config_save(); | ||
| pthread_mutex_unlock(&global_lock); | ||
| return 0; | ||
| } | ||
|
|
||
| void | ||
| api_wizard_init ( void ) | ||
| { | ||
| static api_hook_t ah[] = { | ||
| { "wizard/hello/load", ACCESS_ADMIN, wizard_idnode_load_simple, wizard_hello }, | ||
| { "wizard/hello/save", ACCESS_ADMIN, wizard_idnode_save_simple, wizard_hello }, | ||
| { "wizard/network/load", ACCESS_ADMIN, wizard_idnode_load_simple, wizard_network }, | ||
| { "wizard/network/save", ACCESS_ADMIN, wizard_idnode_save_simple, wizard_network }, | ||
| { "wizard/input/load", ACCESS_ADMIN, wizard_idnode_load_simple, wizard_input }, | ||
| { "wizard/input/save", ACCESS_ADMIN, wizard_idnode_save_simple, wizard_input }, | ||
| { "wizard/status/load", ACCESS_ADMIN, wizard_idnode_load_simple, wizard_status }, | ||
| { "wizard/status/save", ACCESS_ADMIN, wizard_idnode_save_simple, wizard_status }, | ||
| { "wizard/mapping/load", ACCESS_ADMIN, wizard_idnode_load_simple, wizard_mapping }, | ||
| { "wizard/mapping/save", ACCESS_ADMIN, wizard_idnode_save_simple, wizard_mapping }, | ||
| { "wizard/cancel", ACCESS_ADMIN, wizard_cancel, NULL }, | ||
| { NULL }, | ||
| }; | ||
|
|
||
| api_register_all(ah); | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
ec6abbbThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only for initial setup for a "joe" user... I added 'Start wizard' to the global config in the latest commits.
ec6abbbThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PiterEL
https://tvheadend.org/issues/3351