Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

patch: adding a simple '--help' option

Help
Brett
2008-02-13
2013-04-25
  • Brett
    Brett
    2008-02-13

    Included is a straightforward patch to add a '--help' option to the commandline 'fuppes' and 'fuppesd'. I'm sure the formatting could be improved, but this at least makes all of the cmdline options obvious (you just about have to pick through the source otherwise). Hope this is helpful.

    Brett

    Index: src/lib/libmain.cpp

    --- src/lib/libmain.cpp (revision 589)
    +++ src/lib/libmain.cpp (working copy)
    @@ -86,6 +86,20 @@
       #warning todo: check params
      
       for(int i = 0; i < argc; i++) {
    +    if(strcmp(argv[i], "--help") == 0) {
    +       cerr << "FUPPES" << endl;
    +       cerr << "the Free UPnP Entertainment Service" << endl;
    +       cerr << "http://fuppes.ulrich-voelkel.de" << endl;
    +       cerr << endl << endl;
    +       cerr << "       --temp-dir <dir>                        set temp directory (default: ?)" << endl;
    +       cerr << "       --config-file <filename>                use alternate config file (default ~/.fuppes/fuppes.cfg)" << endl;
    +       cerr << "       --database-file <filename>              use alternate database file (default ~/.fuppes/fuppes.db)" << endl;
    +       cerr << "       --vfolder-config-file <filename>        use alternate vfolder config file (default ~/.fuppes/vfolder.cfg)" << endl;
    +       cerr << "       --friendly-name <name>                  set friendly name" << endl;
    +       cerr << "       --log-level [0-3]                       set log level (0-none, 1-normal, 2-extended, 3-debug)" << endl;
    +       cerr << "       --log-file <filename>                   set log file (default: none)" << endl;
    +       return FUPPES_FALSE;
    +       }
         if((strcmp(argv[i], "--config-dir") == 0) && (argc > i + 1)) {
           sConfigDir = argv[i + 1];
           if((sConfigDir.length() > 1) && (sConfigDir.substr(sConfigDir.length() - 1).compare(upnpPathDelim) != 0)) {

     
    • neil sumpter
      neil sumpter
      2008-02-13

      looks very useful - i assumed you could, but never looked into, using different databases/config files, which could be real useful for me.

      out of curiosity, what does the temp dir do? what is it used for?? and what is the default...

      certainly recommend adding this into subsequent releases. thoughts, uli?

       
      • Brett
        Brett
        2008-02-13

        The temp dir option seems to tell fuppes where to put intermediate files that it is transcoding (default is /tmp leading to a /tmp/fuppes/<transcoded files>). It may have other uses, but this is what I've seen.

        The other options are more important since, as far as I can tell, they are the only way you can specify the use of logfiles and default log-levels.

        Along that vein, I'm toying with implementing a subsystem-specific logging scheme since digging through the current log with full debug turned on is time consuming. For instance, it would be very nice to specify a default log-level of info, but a upnp-subsystem log-level of debug. As far as I know there would be subsystems for: db, httpd, upnp, and config parsing. I don't completely understand the streaming backend but I assume it has some elements that could be further broken down and specified as well.

        Thanks for the comment,

        brett

         
    • Ulrich Völkel
      Ulrich Völkel
      2008-02-13

      Thanks for that! I just was too lazy to write it myself :)
      And yes, the temp dir is currently only used for transcoded files.

      about the logging: I also thought of writing a logging mechanism that allows to specify which subsystem to log but without the idea of setting different log levels for each subsystem, which is a good idea.

      Thanks for your help!

      - Uli