Showing posts with label Sitecore Powershell Extensions. Show all posts
Showing posts with label Sitecore Powershell Extensions. Show all posts

Wednesday, April 10, 2019

Automatically tag images with Sitecore Powershell Extensions

A brief introduction

Last month I had the pleasure of participating in Sitecore Hackathon with two colleagues. As preparation we spent a couple of hours looking around for API's that could be fun to make some sort of integration to, which hopefully would fit into one of the announced categories. We had our eyes on IBM's Watson API, which provides a long range of services such as translation, tone analyzation and visual recognition.

We ended up choosing (and winning, yay!) the Sitecore Powershell Extensions category. We made a module that did image recognition and tone analyzation on command. If you're curious as to what we did, you can check it out our Hackathon 2019 github documentation or the Youtube presentation.

Tagging images

The Hackathon entry was made with ribbon buttons and modals, to show off some flashy functionality and make it easily understandable.
Personally i think the tone analyzation isn't quite mature enough as a service to be incorporated in actual Sitecore solutions (however it may just be me who's bad at reading the results).
But I really like the potential of the image tagging. The possibilities for editors with a large image catalog to search images based on their content could be a great tool. I decided to spend a bit of time automating it, and do a quick write-up on it here. It's almost a pure reuse of the Hackathon module, I just used the events integration point as a trigger instead, and made it write all keywords automatically.

Friday, November 9, 2018

Publish viewer/canceller using Sitecore Powershell Extensions

I have only just recently jumped the Sitecore Powershell Extensions (SPE) bandwagon, but I absolutely love it.
Most of the tasks I've used it for so far has been either very straight forward, or very client specific. However we were just asked by a client to make a publish viewer which would list details of current publish actions and queue, as well as being able to canceling queued items.
Similar applications has existed in the past, but it didn't seem like any of them worked properly on Sitecore 8.2 and 9.0 - SPE to the rescue!

First a couple of functions

Most of this could exist in one long script, I just really like splitting them up into individual scripts for easier reuse.

Get-PublishJobs

First off I made a function to get all jobs from the jobmanager, filter them to only see the PublishManager jobs, and then sorting them by PublishDate. This gives returns me a PowerShell array of relevant jobs.

function Get-PublishJobs() 
{
  $category = 'PublishManager'
  [Sitecore.Jobs.JobManager]::GetJobs() | 
           Where-Object -FilterScript { $_.Category -eq $category } | 
           sort @{expression={$_.Options.Parameters[0].PublishDate};Descending=$false}
}