Package io.github.mastodonContentMover
Class MediaFile
java.lang.Object
io.github.mastodonContentMover.MediaFile
Holds in an XML-persistable object the metadata associated with a media file attached
to a
Post
object.
Because this class uses JAXB and instances of it are held within Post
objects, persistance is managed by the associated Post
object (instances of this class are saved when the Post
object that contains them are saved), so no marshalling or unmarshalling code is needed here.- Since:
- 0.01.00
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
Retrieves the alt text or description of the content in the media file associated with thisMediaFile
, corresponding to thedescription
field within Mastodon.protected String
Retrieves the path on the local file system for the media file associated with thisMediaFile
object.protected float
Retrieves x coordinate of the focal point for the media file associated with thisMediaFile
object.protected float
Retrieves y coordinate of the focal point for the media file associated with thisMediaFile
object.protected String
Retrieves the Mastodon media type for the media file associated with thisMediaFile
, corresponding to thedescription
field within Mastodon.protected String
Retrieves the MIME type of the media file associated with thisMediaFile
object, used when reuploading the file to Mastodon to attach to a reposted status.protected String
Retrieves the path on the local file system for the thumbnail for the media file associated with thisMediaFile
object.protected static String
Obtain the suffix that should be attached to the name of a media file (without the file extension) when naming a thumbnail for that media file.protected void
setAltText
(String at) Stores the value of the Mastodondescription
field, which is an alt text or description, for the media file associated with thisMediaFile
object.protected void
Stores the directory where the media file associated with thisMediaFile
object is stored on the local file system.protected void
setFocalPoint
(float x, float y) Stores the x and y coordinates of the focal point for the media file associated with thisMediaFile
object, which allow Mastodon to preview a limited area of an image according to the user's preferences when not all of it is visible in the user interface.
-
Constructor Details
-
MediaFile
- Parameters:
fn
- the filename for the media file to be associated with thisMediaFile
object- Since:
- 0.01.00
-
MediaFile
Creates aMediaFile
object with the filename, directory, Mastodon media type, thumbnail filename, alt text (description) and focal point coordinates (x and y) specified.
MIME type is determined based on the extension of the media file, so it can be used when reuploading the file to Mastodon to attach to a reposted status.- Parameters:
fn
- the filename for the media file to be associated with thisMediaFile
objectd
- the directory where the media file is stored within the local file systemtfn
- the filename of a thumbnail for the media filemm
- the Mastodon media typeat
- the alt text or description of the content in this media filex
- the x coordinate for the focal point for this media filey
- the y coordinate for the focal point for this media file- Since:
- 0.01.00
- See Also:
-
-
Method Details
-
setDirectory
Stores the directory where the media file associated with thisMediaFile
object is stored on the local file system.- Parameters:
d
- the directory where the media file is stored- Since:
- 0.01.00
-
getFilepath
Retrieves the path on the local file system for the media file associated with thisMediaFile
object.- Returns:
- the path on the local file system for the media file
- Since:
- 0.01.00
-
getThumbnailFilepath
Retrieves the path on the local file system for the thumbnail for the media file associated with thisMediaFile
object.- Returns:
- the path on the local file system for the thumbnail file
- Since:
- 0.01.00
-
getThumbnailFileSuffix
Obtain the suffix that should be attached to the name of a media file (without the file extension) when naming a thumbnail for that media file.- Returns:
- the suffix
- Since:
- 0.01.00
-
getMimeType
Retrieves the MIME type of the media file associated with thisMediaFile
object, used when reuploading the file to Mastodon to attach to a reposted status.- Returns:
- the MIME type of the media file
- Since:
- 0.01.00
-
getMastodonMediaType
Retrieves the Mastodon media type for the media file associated with thisMediaFile
, corresponding to thedescription
field within Mastodon. object.- Returns:
- the Mastodon media type for the media file
- Since:
- 0.01.00
- See Also:
-
setAltText
Stores the value of the Mastodondescription
field, which is an alt text or description, for the media file associated with thisMediaFile
object.- Parameters:
at
- the alt text or description of the content in the media file- Since:
- 0.01.00
- See Also:
-
getAltText
Retrieves the alt text or description of the content in the media file associated with thisMediaFile
, corresponding to thedescription
field within Mastodon. object.- Returns:
- the alt text or description of the content in the media file
- Since:
- 0.01.00
- See Also:
-
setFocalPoint
protected void setFocalPoint(float x, float y) Stores the x and y coordinates of the focal point for the media file associated with thisMediaFile
object, which allow Mastodon to preview a limited area of an image according to the user's preferences when not all of it is visible in the user interface.- Parameters:
x
- the x coordinate for the focal point for this media filey
- the y coordinate for the focal point for this media file- Since:
- 0.01.00
- See Also:
-
getFocalPointX
protected float getFocalPointX()- Returns:
- the x coordinate for the focal point for this media file
- Since:
- 0.01.00
- See Also:
-
getFocalPointY
protected float getFocalPointY()- Returns:
- the y coordinate for the focal point for this media file
- Since:
- 0.01.00
- See Also:
-