Are there "TakeScreenshot" parameters?
#1
Hello!
I'm trying to make an addon that names screenshots based on the content being played. IE "ShowName SxxExx Screenshot ###.jpg"

So first I'm trying to figure out how to pass on the filename I want to xbmc.executebuiltin("TakeScreenshot").
In http://kodi.wiki/view/list_of_built-in_functions it says that "TakeScreenshot" doesn't take any parameters so I guess the save path for the screenshot is stored somewhere in the settings.

I would be very grateful if someone would point me to where those settings are and tell me how to manipulate them.

Thanks.
Reply
#2
the filename is harcoded in the kodi source-code.

unless you want to modify the source-code and compile kodi yourself, there's nothing you can do to change it.


edit: the above is incorrect, see below
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
(2016-06-03, 17:48)ronie Wrote: the filename is harcoded in the kodi source-code.

unless you want to modify the source-code and compile kodi yourself, there's nothing you can do to change it.

Thanks.
What about the file path?
Reply
#4
it's stored in guisettings.xml
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
You could do it via code.

Retrieve (via json) the current folder name, change it to a temporary folder (again via json), take the screenshot, rename the file, move it to the original screenshot folder, reset the screenshot folder back to the original. Optionally, delete the temporary folder.


Sent from my iPhone
Reply
#6
PIL could perhaps take a screen shot with some more options?
http://www.varesano.net/blog/fabio/captu...%20windows
Reply
#7
Apologies, however, whilst I don't mean to contradict anyone, there is a way to add parameters to the TakeScreenshot builtin function. I successfully tested this using Kodi.Krypton, however, I do remember seeing this some time ago...

PHP Code:
TakeScreenshot(filePathAndNamePNG

Taken from: GUIBuiltins

PHP Code:
/*! \brief Take a screenshot.
 *  \param params The parameters.
 *  \details params[0] = URL to save file to. Blank to use default.
 *           params[1] = "sync" to run synchronously (optional).
 */
static int Screenshot(const std::vector<std::string>& params)
{
  if (!
params.empty())
  {
    
// get the parameters
    
std::string strSaveToPath params[0];
    
bool sync false;
    if (
params.size() >= 2)
      
sync StringUtils::EqualsNoCase(params[1], "sync");

    if (!
strSaveToPath.empty())
    {
      if (
XFILE::CDirectory::Exists(strSaveToPath))
      {
        
std::string file CUtil::GetNextFilename(URIUtils::AddFileToFolder(strSaveToPath"screenshot%03d.png"), 999);

        if (!
file.empty())
        {
          
CScreenShot::TakeScreenshot(filesync);
        }
        else
        {
          
CLog::Log(LOGWARNING"Too many screen shots or invalid folder %s"strSaveToPath.c_str());
        }
      }
      else
        
CScreenShot::TakeScreenshot(strSaveToPathsync);
    }
  }
  else
    
CScreenShot::TakeScreenshot();

  return 
0;

Reply
#8
thx! i'll update the wiki with this info.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#9
(2016-06-08, 08:56)ronie Wrote: thx! i'll update the wiki with this info.

you're welcome... i took a look at the wiki and you, may, have missed a closing bracket:

current:
PHP Code:
TakeScreenshot([filenameandpath,sync

should be:
PHP Code:
TakeScreenshot([filenameandpath,sync]) 

also, it may be worth mentioning that the supplied file extension must be "PNG"; i - out of curiosity - tried "bmp, jpg", but got an error... something about format not being supported.

thnx!
Reply
#10
fixed, thx!
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply

Logout Mark Read Team Forum Stats Members Help
Are there "TakeScreenshot" parameters?0