diff --git a/README.md b/README.md index 6951ae1..7eea137 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ It requires the following perl modules * Term::ReadKey * Hash::Merge::Simple * Scalar::Util - * Image::Size Here're the vailable options: diff --git a/patrix.spec b/patrix.spec index f0c363b..f8fa1cb 100644 --- a/patrix.spec +++ b/patrix.spec @@ -23,7 +23,6 @@ Requires: perl(URI::Escape) Requires: perl(Term::ReadKey) Requires: perl(Hash::Merge::Simple) Requires: perl(Scalar::Util) -Requires: perl(Image::Size) %description Patrix is a simple (and quite limited) client for the Matrix communication network diff --git a/scripts/patrix b/scripts/patrix index 2d2c9f1..c85e5cf 100644 --- a/scripts/patrix +++ b/scripts/patrix @@ -15,7 +15,6 @@ use URI::Escape; use Term::ReadKey; use Hash::Merge::Simple qw(merge); use Scalar::Util qw(looks_like_number); -use Image::Size; our $opt; @@ -269,7 +268,6 @@ sub send_file { content_type => $mime, content => slurp($file) }); - debug("File upload response is\n" . to_json(from_json($resp->decoded_content), { pretty => 1 })); die "Error uploading file\n" unless ($resp->is_success); # If everything went well, the server replied with the URI of our file, which we can # now post on the room @@ -288,12 +286,15 @@ sub send_file { }, url => $file_uri }; + # If the file is an image, audio or video, send it as such if ($mime =~ m/^image/){ - # The file is an image, change the message type and add the required info so it is - # displayed as an image - my ($w,$h) = imgsize($file); $json->{msgtype} = 'm.image'; - ($json->{info}->{h}, $json->{info}->{w}) = imgsize($file); + } + elsif ($mime =~ /^audio/){ + $json->{msgtype} = 'm.audio'; + } + elsif ($mime =~ /^video/){ + $json->{msgtype} = 'm.video'; } $resp = send_request({ uri => $uri,