Skip to content

Commit

Permalink
Merge pull request xbmc#17735 from enen92/makelegalfilename
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins4kodi authored and Maven85 committed Aug 4, 2020
1 parent 976cebd commit def9ed4
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 39 deletions.
60 changes: 60 additions & 0 deletions xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/modules_python.dox
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,66 @@ web applications or frameworks for the Python programming language.
"",
<b>xbmc.monitor().onDatabaseScanStarted()</b> function was removed completely.
}
\python_removed_function{
create,
"",
<b>xbmcgui.DialogBusy().create()</b> function was removed completely.
}
\python_removed_function{
update,
"",
<b>xbmcgui.DialogBusy().update()</b> function was removed completely.
}
\python_removed_function{
close,
"",
<b>xbmcgui.DialogBusy().close()</b> function was removed completely.
}
\python_removed_function{
iscanceled,
"",
<b>xbmcgui.DialogBusy().iscanceled()</b> function was removed completely.
}
\python_removed_function{
setIconImage,
"",
<b>xbmcgui.ListItem().setIconImage()</b> function was removed completely.
}
\python_removed_function{
setThumbnailImage,
"",
<b>xbmcgui.ListItem().setThumbnailImage()</b> function was removed completely.
}
\python_removed_function{
getdescription,
"",
<b>xbmcgui.ListItem().getdescription()</b> function was removed completely.
}
\python_removed_function{
getduration,
"",
<b>xbmcgui.ListItem().getduration()</b> function was removed completely.
}
\python_removed_function{
getfilename,
"",
<b>xbmcgui.ListItem().getfilename()</b> function was removed completely.
}
\python_removed_function{
getfilename,
"",
<b>xbmcgui.Window().getResolution()</b> function was removed completely.
}
\python_removed_function{
setCoordinateResolution,
"",
<b>xbmcgui.Window().setCoordinateResolution()</b> function was removed completely.
}
\python_removed_function{
makeLegalFilename,
"",
<b>xbmc.makeLegalFilename()</b> function was moved to the xbmcvfs module.
}
*/
/*!
@page python_v18 Python API v18
Expand Down
6 changes: 0 additions & 6 deletions xbmc/interfaces/legacy/ModuleXbmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,6 @@ namespace XBMCAddon
return StringUtils::Format("%08x.tbn", crc);
}

String makeLegalFilename(const String& filename, bool fatX)
{
XBMC_TRACE;
return CUtil::MakeLegalPath(filename);
}

String translatePath(const String& path)
{
XBMC_TRACE;
Expand Down
33 changes: 0 additions & 33 deletions xbmc/interfaces/legacy/ModuleXbmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -633,39 +633,6 @@ namespace XBMCAddon
String getCacheThumbName(const String& path);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
///
/// \ingroup python_xbmc
/// @brief \python_func{ xbmc.makeLegalFilename(filename[, fatX]) }
///-----------------------------------------------------------------------
/// Returns a legal filename or path as a string.
///
/// @param filename string or unicode - filename/path to
/// make legal
/// @param fatX [opt] bool - True=Xbox file system(Default)
/// @return Legal filename or path as a string
///
///
/// @note If fatX is true you should pass a full path. If fatX is false only pass
/// the basename of the path.\n\n
/// You can use the above as keywords for arguments and skip certain optional arguments.
/// Once you use a keyword, all following arguments require the keyword.
///
///
/// ------------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ..
/// filename = xbmc.makeLegalFilename('F:\\Trailers\\Ice Age: The Meltdown.avi')
/// ..
/// ~~~~~~~~~~~~~
///
makeLegalFilename(...);
#else
String makeLegalFilename(const String& filename,bool fatX = true);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
///
/// \ingroup python_xbmc
Expand Down
7 changes: 7 additions & 0 deletions xbmc/interfaces/legacy/ModuleXbmcvfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ namespace XBMCAddon
return XFILE::CFile::Exists(path, false);
}

// make legal file name
String makeLegalFilename(const String& filename)
{
XBMC_TRACE;
return CUtil::MakeLegalPath(filename);
}

// make a directory
bool mkdir(const String& path)
{
Expand Down
37 changes: 37 additions & 0 deletions xbmc/interfaces/legacy/ModuleXbmcvfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,43 @@ namespace XBMCAddon
bool exists(const String& path);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
///
/// \ingroup python_xbmcvfs
/// @brief \python_func{ xbmcvfs.makeLegalFilename(filename) }
///-----------------------------------------------------------------------
/// Returns a legal filename or path as a string.
///
/// @param filename string - filename/path to make legal
/// @return Legal filename or path as a string
///
///
/// @note The returned value is platform-specific. This is due to the fact that
/// the chars that need to be replaced to make a path legal depend on the
/// underlying OS filesystem. This is useful, for example, if you want to create
/// a file or folder based on data over which you have no control (e.g. an external API).
///
///
///-------------------------------------------------------------------------
/// @python_v19 New function added (replaces old **xbmc.makeLegalFilename**)
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ..
/// # windows
/// >> xbmcvfs.makeLegalFilename('C://Trailers/Ice Age: The Meltdown.avi')
/// C:\Trailers\Ice Age_ The Meltdown.avi
/// # non-windows
/// >> xbmcvfs.makeLegalFilename("///\\jk???lj????.mpg")
/// /jk___lj____.mpg
/// ..
/// ~~~~~~~~~~~~~
///
makeLegalFilename(...);
#else
String makeLegalFilename(const String& filename);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
///
/// \ingroup python_xbmcvfs
Expand Down

0 comments on commit def9ed4

Please sign in to comment.