-
-
Notifications
You must be signed in to change notification settings - Fork 737
Adds ability to dynamically adjust seconds-per-day. #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,7 @@ void GourceSettings::help(bool extended_help) { | |
printf(" for a number of seconds (default: 3)\n"); | ||
printf(" --disable-auto-skip Disable auto skip\n"); | ||
printf(" -s, --seconds-per-day SECONDS Speed in seconds per day (default: 10)\n"); | ||
printf(" --transition TIMESTAMP Timestamp for transitions\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will also need a bit of README / man page documentation for how to use this feature. |
||
printf(" --realtime Realtime playback speed\n"); | ||
printf(" --no-time-travel Use the time of the last commit if the\n"); | ||
printf(" time of a commit is in the past\n"); | ||
|
@@ -288,7 +289,7 @@ GourceSettings::GourceSettings() { | |
arg_types["bloom-intensity"] = "float"; | ||
arg_types["bloom-multiplier"] = "float"; | ||
arg_types["elasticity"] = "float"; | ||
arg_types["seconds-per-day"] = "float"; | ||
arg_types["seconds-per-day"] = "multi-value"; | ||
arg_types["auto-skip-seconds"] = "float"; | ||
arg_types["stop-at-time"] = "float"; | ||
arg_types["max-user-speed"] = "float"; | ||
|
@@ -312,6 +313,7 @@ GourceSettings::GourceSettings() { | |
arg_types["file-show-filter"] = "multi-value"; | ||
arg_types["follow-user"] = "multi-value"; | ||
arg_types["highlight-user"] = "multi-value"; | ||
arg_types["transition"] = "multi-value"; | ||
|
||
arg_types["log-level"] = "string"; | ||
arg_types["background-image"] = "string"; | ||
|
@@ -1179,16 +1181,56 @@ void GourceSettings::importGourceSettings(ConfFile& conffile, ConfSection* gourc | |
|
||
if((entry = gource_settings->getEntry("seconds-per-day")) != 0) { | ||
|
||
if(!entry->hasValue()) conffile.entryException(entry, "specify seconds-per-day (seconds)"); | ||
ConfEntryList* seconds_list = gource_settings->getEntries("seconds-per-day"); | ||
|
||
float seconds_per_day = entry->getFloat(); | ||
for(ConfEntryList::iterator it = seconds_list->begin(); it != seconds_list->end(); it++) { | ||
|
||
if(seconds_per_day<=0.0f) { | ||
conffile.invalidValueException(entry); | ||
entry = *it; | ||
|
||
if(!entry->hasValue()) conffile.entryException(entry, "specify seconds-per-day (seconds)"); | ||
|
||
float seconds_per_day = entry->getFloat(); | ||
if(seconds_per_day<=0.0f) { | ||
conffile.invalidValueException(entry); | ||
} | ||
|
||
// convert seconds-per-day to days-per-second | ||
days_per_second_list.push_back(1.0 / seconds_per_day); | ||
} | ||
|
||
// initialize with first value | ||
days_per_second = days_per_second_list.front(); | ||
days_per_second_list.pop_front(); | ||
} | ||
|
||
if((entry = gource_settings->getEntry("transition")) != 0) { | ||
|
||
ConfEntryList* timestamps = gource_settings->getEntries("transition"); | ||
|
||
for(ConfEntryList::iterator it = timestamps->begin(); it != timestamps->end(); it++) { | ||
|
||
entry = *it; | ||
|
||
if(!entry->hasValue()) conffile.entryException(entry, "specify transition timestamp (YYYY-MM-DD hh:mm:ss)"); | ||
|
||
std::string timestamp_string = entry->getString(); | ||
|
||
time_t transition; | ||
|
||
if (parseDateTime(timestamp_string, transition)) { | ||
transitions.push_back(transition); | ||
} else { | ||
conffile.invalidValueException(entry); | ||
} | ||
} | ||
|
||
// convert seconds-per-day to days-per-second | ||
days_per_second = 1.0 / seconds_per_day; | ||
// Make sure that seconds-per-day is specified and that there are | ||
// exactly 1 more seconds-per-day specified than transitions. | ||
if(gource_settings->getEntry("seconds-per-day") == 0 || ( | ||
gource_settings->getEntries("seconds-per-day")->size() != | ||
timestamps->size() + 1)) { | ||
conffile.entryException(entry, "transition requires exactly 1 more seconds-per-day specified"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe |
||
} | ||
} | ||
|
||
if((entry = gource_settings->getEntry("auto-skip-seconds")) != 0) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,8 +197,6 @@ Gource* GourceShell::getNext() { | |
return 0; | ||
} | ||
|
||
gGourceSettings.importGourceSettings(*conf, *gource_settings); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gource supports config file having mutiple [gource] sections, so you can have multiple configurations in one file and it will cycle to the next one when the current one concludes. So it still needs to handle that, we'll just need to come up with another way to avoid it creating duplicate multi value entries. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The overwriting behaviour is kind of nice as it allows for instance having a config file, but also having command line parameters in addition to the config file settings. Appending to existing multi value lists probably isnt useful though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could avoid dealing with this issue if you use comma separators (e.g. like the |
||
|
||
//recording a video kind of implies you want this, unless: | ||
// -- dont stop requested | ||
// -- loop requested | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There 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.
Because Gource can be used interactively and you could seek the timeline back to before the transition, this should really iterate over the transitions to find the relevant transition rather than modify the setting.